Click using Webscraping with Selenium

1

I'm starting my studies with Webscraping and I'm having trouble giving a second click on a new page.

I'm trying to access my email using Selenium, I can fill in my email and click to go to next page where I can fill in the field with my password, so far everything normal. The problem arose 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()

    
asked by anonymous 18.12.2018 / 01:28

2 answers

2

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

    
18.12.2018 / 02:02
0

Apparently if you 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 clicks

    
20.12.2018 / 13:21