예제 #1
0
def entrarProduto2(driver):
    #escolhe o produto
    button_click(
        driver,
        by_css_selector=
        'a[href="/c/Impressoras_3D/p/Impressora_3D_Anycubic_I3_Mega_S"]')
    sleep(1)
예제 #2
0
def add_cupom_troca(driver):
    button_click(
        driver,
        by_xpath=
        '/html/body/section/div[4]/div[2]/div/div[1]/div/div[2]/div/form/button/span[2]'
    )
    sleep(1)
예제 #3
0
def deslogarAdm(driver):
    #Desloga o usuário na tela do administrador
    button_click(driver, by_css_selector='a[href="/logout"]')
    WebDriverWait(driver, 2).until(
        EC.element_to_be_clickable(
            (By.XPATH, '/html/body/div[2]/div/div/nav/div/div[2]/div/button')))
    sleep(0.5)
예제 #4
0
def acessar_pedido_troca(driver):
    button_click(
        driver,
        by_xpath=
        '/html/body/main/section/div[3]/table/tbody/tr[4]/td[5]/div/div[2]/form/button'
    )
    sleep(0.5)
예제 #5
0
def entrarProduto3(driver):
    #escolhe o produto
    button_click(
        driver,
        by_css_selector=
        'a[href="/c/Impressoras_3D/p/Impressora_3D_Creality_LD-002R"]')
    sleep(1)
예제 #6
0
def acessar_pedido_compra(driver):
    button_click(driver,
                 by_xpath='/html/body/main/section/div[3]/div[4]/span/a[2]')
    sleep(1)
    button_click(
        driver,
        by_xpath='//*[@id="example"]/tbody/tr/td[6]/div/div[2]/form/button')
    sleep(0.5)
예제 #7
0
def add_cupom_promocao(driver, codigo):
    driver.find_element_by_id('cupom').send_keys(codigo)
    sleep(0.2)
    button_click(
        driver,
        by_xpath=
        '/html/body/section/div[4]/div[2]/div/div[2]/div/form/div/div[2]/button'
    )
    sleep(1)
예제 #8
0
def cadastrarNovoEndereco(driver):
    #Cadastra novo endereço
    button_click(
        driver,
        by_xpath='/html/body/main/section/div[1]/div[2]/div/div[1]/div/div/a')
    sleep(0.5)

    #Reaproveita o código do cadastro inicial
    cadastrarCliente.cadastrarEndereco(driver)
예제 #9
0
def meusPedidos(driver):
    #Acessa meus pedidos
    button_click(driver, by_xpath='//*[@id="bt_pedidos"]')
    sleep(0.5)

    button_click(
        driver,
        by_xpath='/html/body/div[3]/div/div/nav/div/ul/li[4]/div/ul[1]/li/a')
    sleep(0.5)
예제 #10
0
def cadastrarNovoCartao(driver):
    #Cadastra um novo cartão
    button_click(
        driver,
        by_xpath='/html/body/main/section/div/div[2]/div/div[1]/div/div/a')
    sleep(0.5)

    #Reaproveita o código do cadastro inicial
    cadastrarCliente.cadastrarPagamento(driver)
예제 #11
0
def login_carrinho(driver, email, senha):
    driver.find_element_by_id('inputUsuario').send_keys(email)
    sleep(0.5)

    driver.find_element_by_id('inputSenha').send_keys(senha)
    sleep(0.5)

    button_click(driver, by_xpath='/html/body/section/div/form/div/button')
    sleep(1)
예제 #12
0
def entrarMenuUsuario(driver):
    #Entra no menu do usuário

    #button_click(
    #    driver, by_xpath='/html/body/div[2]/header/div/div[3]/div/ul/li[2]/a')
    try:
        button_click(driver, by_css_selector='a[href="/admin/index"]')
    except:
        button_click(driver, by_css_selector='a[href="/cliente/index"]')
    sleep(0.5)
예제 #13
0
def acessar_logistica_compra(driver):
    button_click(driver,
                 by_xpath='/html/body/main/section/div[3]/div[4]/span/a[2]')
    sleep(0.5)
    button_click(
        driver,
        by_xpath=
        '/html/body/main/section/div[3]/table/tbody/tr[1]/td[5]/div/form/button'
    )
    sleep(0.5)
예제 #14
0
def clicarLogin(driver):
    #Clica no login
    button_click(driver,
                 by_xpath='/html/body/div[2]/header/div/div[3]/div/a[2]')
    try:
        WebDriverWait(driver, 2).until(
            EC.element_to_be_clickable(
                (By.CSS_SELECTOR,
                 'a[href="/cadastro/cadastroDadosPessoais"]')))
    except:
        WebDriverWait(driver, 2).until(
            EC.element_to_be_clickable((By.CSS_SELECTOR, 'a[href="/logout"]')))
    sleep(0.5)
예제 #15
0
def logarUsuario(driver, email, senha):
    #Loga o usuário no index
    driver.find_element_by_id('inputEmail').send_keys(email)
    sleep(0.5)

    driver.find_element_by_id('inputPassword').send_keys(senha)
    sleep(0.5)

    button_click(
        driver,
        by_xpath=
        '/html/body/div[2]/header/div/div[3]/div/div/div/form/div/button')
    sleep(1)
예제 #16
0
def trocarProdutoPedido(driver):
    #Solicita a troca de produto
    button_click(driver,
                 by_css_selector='button[data-bs-target="#trocarPedidoModal"]')
    sleep(0.5)

    driver.find_element_by_xpath('//*[@id="iQuantidade"]').clear()
    driver.find_element_by_xpath('//*[@id="iQuantidade"]').send_keys('2')
    driver.find_element_by_xpath('//*[@id="descricao"]').send_keys('Defeito')

    sleep(0.2)

    button_click(driver, by_id="confirmarTroca")
    #button_click(driver, by_xpath='//*[@id="trocarPedidoModal"]/div/div/div[1]/button')
    sleep(0.5)
예제 #17
0
def cadastrarInformacoes(driver):
    #Registra as informações pessoais
    WebDriverWait(driver, 5).until(
        EC.presence_of_element_located((By.ID, 'confirm_password')))

    driver.find_element_by_id('nome').send_keys('João da Silva')
    sleep(0.2)

    driver.find_element_by_id('dataNascimento').send_keys('01/01/2000')
    sleep(0.2)

    select = Select(driver.find_element_by_id('tipoTelefone'))
    select.select_by_value('Celular')
    sleep(0.2)

    driver.find_element_by_id('DDD').send_keys('11')
    sleep(0.2)

    driver.find_element_by_id('telefone').send_keys('5555-54444')
    sleep(0.2)

    driver.find_element_by_id('sexoMasculino').click()
    sleep(0.2)

    select = Select(driver.find_element_by_id('documento'))
    select.select_by_value('CPF')
    sleep(0.2)

    driver.find_element_by_id('numeroDocumento').send_keys('111.111.111-11')
    sleep(0.2)

    driver.find_element_by_id('email').send_keys('*****@*****.**')
    sleep(0.2)

    driver.find_element_by_id('password').send_keys('Cliente10@')
    sleep(0.2)

    driver.find_element_by_id('confirm_password').send_keys('Cliente10@')
    sleep(0.2)

    button_click(driver,
                 by_css_selector='button[class="btn border shadow-sm"]')
    sleep(0.5)
예제 #18
0
def cadastrarEndereco(driver):
    #Registra as informações de endereço
    WebDriverWait(driver, 5).until(
        EC.presence_of_element_located(
            (By.CSS_SELECTOR, 'textarea[id="observacao"]')))

    button_click(driver, by_id="endCobranca")
    sleep(0.2)

    driver.find_element_by_id('descricaoImovel').send_keys('Casa')
    sleep(0.2)

    select = Select(driver.find_element_by_id('tipoLogradouro'))
    select.select_by_value('Avenida')
    sleep(0.2)

    driver.find_element_by_id('logradouro').send_keys(
        'Voluntário Pinheiro Franco')
    sleep(0.2)

    driver.find_element_by_id('enderecoNum').send_keys('1234')
    sleep(0.2)

    driver.find_element_by_id('complemento').send_keys('Casa 1')
    sleep(0.2)

    driver.find_element_by_id('CEP').send_keys('08756-652')
    sleep(0.2)

    driver.find_element_by_id('cidade').send_keys('Mogi das Cruzes')
    sleep(0.2)

    select = Select(driver.find_element_by_id('estado'))
    select.select_by_value('SP')
    sleep(0.2)

    driver.find_element_by_id('pais').send_keys('Brasil')
    sleep(0.2)

    button_click(driver, by_id='confirmar')
    sleep(0.5)
예제 #19
0
def cadastrarPagamento(driver):
    #Registra as informações de pagamento
    WebDriverWait(driver,
                  5).until(EC.presence_of_element_located(
                      (By.ID, 'cvvCartao')))

    driver.find_element_by_id('numCartao').send_keys('1234 1234 1234 1234')
    sleep(0.2)

    driver.find_element_by_id('nomeCartao').send_keys('João da Silva')
    sleep(0.2)

    select = Select(driver.find_element_by_id('bandeiraCartao'))
    select.select_by_value('1')
    sleep(0.2)

    driver.find_element_by_id('validadedCartao').send_keys('12/25')
    sleep(0.2)

    driver.find_element_by_id('cvvCartao').send_keys('123')
    sleep(0.2)

    button_click(driver, by_id='confirmar')
    sleep(0.5)
예제 #20
0
def confirmarPagamento(driver):
    #Confirmar pagamento

    #Listar produtos
    button_click(driver, by_css_selector='div[class="row valores"]')
    sleep(0.5)

    #Listar cupons
    button_click(driver, by_css_selector='div[class="row cupons"]')
    sleep(0.5)

    #Listar meus cartões
    button_click(driver, by_css_selector='div[class="row cartoes"]')
    sleep(0.5)
    driver.find_element_by_css_selector('body').send_keys(Keys.PAGE_DOWN)

    #Confirmar pagamento
    button_click(driver, by_id="confirmar")
    sleep(0.5)
예제 #21
0
def confirmarPedido(driver):
    #Confirmar pedido

    #Listar produtos
    button_click(driver, by_css_selector='div[class="row valores"]')
    sleep(0.5)

    #Listar endereço de entrega
    button_click(driver, by_css_selector='div[class="row enderecos"]')
    sleep(0.5)

    #Listar cupons
    button_click(driver, by_css_selector='div[class="row cupons"]')
    driver.find_element_by_css_selector('body').send_keys(Keys.PAGE_DOWN)
    sleep(0.5)

    #Confirmar pedido
    button_click(driver, by_id="confirmar")
    sleep(1)
예제 #22
0
def meuRanking(driver):
    #Acessa meu ranking
    button_click(driver, by_css_selector='a[href="/cliente/meuRanking"]')
    sleep(0.5)

    button_click(driver,
                 by_css_selector='i[class="fs-2 bi bi-arrow-right-circle"]')
    sleep(0.5)

    button_click(driver,
                 by_css_selector='i[class="fs-2 bi bi-arrow-right-circle"]')
    sleep(0.5)
예제 #23
0
def aumentar_produto(driver):
    #Clicar no produto 2
    button_click(
        driver,
        by_xpath=
        '/html/body/section/div/div[3]/div[2]/div/div[2]/div[3]/div/div/form[3]/button'
    )
    sleep(1)

    #Clicar no produto 3
    button_click(
        driver,
        by_xpath=
        '/html/body/section/div/div[3]/div[2]/div/div[3]/div[3]/div/div/form[3]/button'
    )
    sleep(1)

    #Clicar no produto 3
    button_click(
        driver,
        by_xpath=
        '/html/body/section/div/div[3]/div[2]/div/div[3]/div[3]/div/div/form[3]/button'
    )
    sleep(1)
예제 #24
0
def entrarCarrinho(driver):
    #Entra no carrinho
    button_click(driver, by_css_selector='a[href="/carrinho/meuCarrinho"]')
    sleep(0.5)
예제 #25
0
def deslogarUsuario(driver):
    #Desloga o usuário no index
    button_click(driver, by_css_selector='a[href="/logout"]')
    sleep(0.5)
예제 #26
0
def menuProduto(driver):
    #Acessa o menu dos produtos
    button_click(driver, by_css_selector='button[data-bs-target="#produtos"]')
    sleep(0.5)
예제 #27
0
def clicarCadastrarNovoUsuario(driver):
    #Clica no cadastro de novo usuário
    button_click(driver,
                 by_css_selector='a[href="/cadastro/cadastroDadosPessoais"]')
    sleep(0.5)
예제 #28
0
def cadastrarProduto(driver):
    #Cadastra um novo produto
    button_click(driver, by_css_selector='a[href="/admin/cadastrarProdutos"]')
    sleep(0.5)
예제 #29
0
def justificativaProdutos(driver):
    #Visualiza todas as justificativas de produtos cadastradas
    button_click(driver,
                 by_css_selector='a[href="/admin/justificativasProdutos"]')
    sleep(0.5)
예제 #30
0
def listarProdutos(driver):
    #Lista todos os produtos cadastrados
    button_click(driver, by_css_selector='a[href="/admin/listarProdutos"]')
    sleep(0.5)