Angular JS Selenium cannot click a button by python code on mac

+1 vote

I have a button, i can successfully find it and capture it's text. However click is not working. Can someone help.

<button class="yellow labeled icon button no-margin" type="button">
<div class="icon my_class"></div>
<span class="ttt">Add new student</span>

This works:

return driver.find_element(By.XPATH, 'xpath').text

But this does not work and "no exception". Code pass but click not done.

driver.find_element(By.XPATH, 'xpath').click()
Aug 9, 2018 in Selenium by Martin
• 4,330 points

1 answer to this question.

+1 vote
Best answer

You can try clicking it with javascript :

element = driver.find_element(By.XPATH, 'xpath') driver.execute_script("arguments[0].click();", element)

Hope this will solve your problem.

To know more about Angular, I would recommend you to join Angular online course today.


answered Aug 9, 2018 by Samarpit
• 5,890 points

selected Dec 13, 2019 by Kalgi
Really really grateful for this answer, had to search for so long..... thanks a lot mate
This works !!

Related Questions In Selenium

0 votes
1 answer

Cannot click on a button using selenium

The error that I figured out was ...READ MORE

answered Jan 4, 2019 in Selenium by Dushyant
0 votes
2 answers

Python & Selenium: How to find and click on YouTube's Like button

Hello Nitin, as the Like button on ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,080 points
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
0 votes
1 answer

Click on a button within a pop-up window with python selenium

It's not an Alert but a Modal Dialog Box. You ...READ MORE

answered Jun 20, 2018 in Selenium by Samarpit
• 5,890 points
0 votes
1 answer

Select a drop down value of angular js application using selenium using text

To select drop down use following, driver.findElements(By.className("Your dropdown ...READ MORE

answered Jun 18, 2018 in Selenium by Samarpit
• 5,890 points