Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Selenium ng-click action

I've been searching for a solution here on Stackoverflow or Google, but unfortunately I couldn't find any solution. I'm trying to do webscrape on a website, but I can not click on a button with Python + Selenium + Chrome webdriver.

The HTML code on the website:

<button type="button" ng-click="launch()" title="HTTP/HTTPS: WebSQL">
<div class="flex-column-centered">
    <f-icon class="bookmark-icon-large fa-globe" ng-class="TYPE_MAP[bookmark.apptype].icon"></f-icon>
    <span class="ng-binding">WebSQL</span>
</div> </button>

I understand that is AngularJS and I tried CSS selector and Xpath, none of these seem to work in my case. Any help would be appreciated!

like image 777
barnam Avatar asked Oct 19 '25 09:10

barnam


1 Answers

Can you try this xpath :

//span[text()='WebSQL']/../..

I would suggest you to have explicit wait like this :

WebDriverWait(driver , 10).until(EC.element_to_be_clickable((By.XPATH, "//span[text()='WebSQL']/../.."))).click()

Imports :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
like image 163
cruisepandey Avatar answered Oct 21 '25 23:10

cruisepandey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!