Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97796

Why in Python Selenium click() not working but send_keys('\n') is working?

$
0
0

I have a web page with more few buttons with same class and name and when clicked they just disappear and do nothing. So I first tried this but it didn't work:

buttons = driver.find_elements_by_xpath('//*[@class="btn"]')
buttons[1].click()
buttons = driver.find_elements_by_xpath('//*[@class="btn"]')
buttons[2].click()
buttons = driver.find_elements_by_xpath('//*[@class="btn"]')
buttons[3].click()

And then found a solution with:

buttons = driver.find_elements_by_xpath('//*[@class="btn"]')
buttons[1].send_keys('\n')

I am new to Python so can anyone explain me what is the reason for not working with click but with send_keys('\n')?


Viewing all articles
Browse latest Browse all 97796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>