Category : selenium

I have got this piece of html code: <span class=”amount ng-binding ng-scope” ng-if=”object.numberOfReactions !== null”>41</span> I want to acces the 41 number by using driver.find_elements_by_xpath, my best try is driver.find_elements_by_xpath(//div[@ng.if=’object.numberOfReactions !== null’])but this gives an empty list []. Help would be greatly appreciated. Source: Python..

Read more

I’m coding a script to track price products on Amazon. But my code only works well for about 15 minutes, and then appear above error! This is my code: from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.common.exceptions import TimeoutException from selenium.webdriver.support import expected_conditions as EC ..

Read more

I have a page where both of the following elements or only the one will be visible. How can I check if any of these two elements exist? My code is for example: def element_one(): driver.find_element(By.CSS_SELECTOR, ".selector_one").is_displayed() def element_two(): driver.find_element(By.CSS_SELECTOR, ".selector_two").is_displayed() if element_one() or element_two(): print("OK") else: print("ERROR") Doesn’t work for me if also tried ..

Read more

I’m writing a simple script to automatize the access in a platform with SSL Certificate, when i navigate in the url, the browser opens the popup for selecting the certificate, as shown in the photo. Im using this portion of code to interact with the popup, but nothing happens. alert_obj = driver.switch_to_alert().accept() I can’t interact ..

Read more