Untitled

 avatar
unknown
plain_text
9 months ago
1.2 kB
4
Indexable
driver.get('https:cursoautomacao.netlify.app/desafios.html')
time.sleep(1)
janela_atual = driver.current_window_handle

driver.execute_script('window.scrollBy(0,2700)')
time.sleep(1)
botao_novajanela = driver.find_element(By.XPATH, "//button[text()='Abrir nova janela']")
driver.execute_script('arguments[0].click()', botao_novajanela)
time.sleep(3)
janelas = driver.window_handles
for janela in janelas:
    if janela not in janela_atual:
        driver.switch_to.window(janela)
        time.sleep(1)
        campo_escrever = driver.find_element(By.XPATH, "//textarea[@id='opiniao_sobre_curso']")
        time.sleep(1)
        driver.execute_script('arguments[0].click()', campo_escrever)
        time.sleep(1)
        campo_escrever.send_keys('O Curso é Ótimo. Estou muito satisfeito!')
        time.sleep(1)
        driver.execute_script('window.scrollBy(0,200)')
        time.sleep(2)
        botao_pesquisar = driver.find_element(By.ID, "fazer_pesquisa")
        botao_pesquisar.click()
        time.sleep(1)
        driver.close()
driver.switch_to.window(janela_atual)
time.sleep(1)
campo = driver.find_element(By.ID, 'campo_desafio7')
campo.send_keys('Teste do Curso')
input(' ')
Editor is loading...
Leave a Comment