Click using Webscraping with Selenium

Asked

Viewed 109 times

1

I am starting my studies with Webscraping and I have the problem at the time of giving a second click on a new page.

I am trying to access my email using Selenium, I can fill my email and click to follow to the next page where I can fill the field with my password, until here everything normal. The problem arises when I have to click on another button to enter, I can do this.

import bs4
from selenium import webdriver

#Acessando o link
driver = webdriver.Chrome(`executable_path='/Users/gabrielmizuno/Desktop/chromedriver'`)
driver.get('https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=13&ct=1545089604&rver=7.0.6737.0&wp=MBI_SSL&wreply=https%3a%2f%2foutlook.live.com%2fowa%2f%3fauthRedirect%3dtrue%26nlp%3d1%26RpsCsrfState%3df53acbd7-cdac-5727-facb-5c96b414a0ec&id=292841&CBCXT=out&lw=1&fl=dob%2cflname%2cwld&cobrandid=90015')

#Preenchendo email e clicando
email = driver.find_element_by_id('i0116')
email.send_keys('MEU E-MAIL')
driver.find_element_by_id("idSIButton9").click()

#Preenchendo senha e clicando
senha = driver.find_element_by_id('i0118')
senha.send_keys('MINHA SENHA')
driver.find_element_by_id("idSIButton9").click()

Elementos do ultimo botão

  • Let me get this straight... By filling in the login values and clicking, it then fills in the password and does not click?

  • Exactly this, the email and password were filled in the correct way but when giving the last click it does not click.

  • It may seem obvious, but have you checked if the ID you are clicking on exists? try to check what is coming in the "driver.find_element_by_id" in the last line, in case the problem is asynchronous.

  • I sent an answer to your problem, try to run and tell me if it worked blz?

  • Teliz gave a check is the ID this right

  • After filling in the password you can log in with the push of the enter button?

  • Ola Bulfaitelo this idea of Enter worked dps to put my email, but at the time of giving Enter in the password nothing happened

Show 2 more comments

2 answers

2

I found that this same button has a class="btn btn-block btn-primary", you can use the class as parameter of the second click to solve your problem!

  • 1

    Ola Andre vi q there is this class but as I’m starting I’m not able to access, could give me another help?

1

Apparently put

time.sleep(2)

#Preenchendo senha e clicando
senha = driver.find_element_by_id('i0118')
senha.send_keys('MINHA SENHA')
time.sleep(2)
driver.find_element_by_id("idSIButton9").click()

It makes the click

Browser other questions tagged

You are not signed in. Login or sign up in order to post.