selenium

selenium.common.exceptions.NoSuchElementException: Message: Web element reference not seen before using GeckoDriver Firefox and Selenium with Python

我怕爱的太早我们不能终老 提交于 2021-01-27 14:09:49
问题 I'm trying to get the data for several different tests from a test prep site. There are different subjects, each of which has a specialization, each of which has a practice-test, each of which has several questions. subject <--- specialization <---- practice-test *------ question Here's my code: from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC

ExpectedConditions.invisibilityOfElementLocated doesn't work

孤者浪人 提交于 2021-01-27 13:40:43
问题 I have this code wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("....."))); webDriver.findElement(By.xpath(".......")).click(); Sometimes I get exception: org.openqa.selenium.WebDriverException: unknown error: Element <a href="#" onclick="showRelatedPerson();return false;" class="button-alt button-icon">...</a> is not clickable at point (1233, 710). Other element would receive the click: <div id="jquery-msg-bg" style="width: 100%; height: 100%; top: 0px; left: 0px;"></div>

python selenium - takes a lot of time when it does not find elements

十年热恋 提交于 2021-01-27 13:12:16
问题 my code scans a lot of internet pages with chromedriver and searches for the same element in each page with "find_elements_by_xpath" Lines = driver.find_elements_by_xpath( '//*[@id="top"]/div[contains(@style, "display: block;")]/' 'div[contains(@style, "display: block;")]//tbody//a[contains(@title, "Line")]') When it finds, one or multiple, it works fast and good. But, when the XPath doesn't exist it runs for 6-7 seconds and then moves on. Can I limit the search for 1 second, And if it doesn

Select Javascript created element in Selenium Python

别来无恙 提交于 2021-01-27 13:05:47
问题 I have the following element in a web page. <button type="submit" class="zsg-button_primary contact-submit-button track-ga-event" data-ga-category="contact" data-ga-action="email" data-ga-label="rentalbuilding" data-ga-event-content="false" data-ga-event-details="" id="yui_3_18_1_2_1482045459111_1278"> <span class="zsg-loading-spinner hide"></span> <span class="button-text" id="yui_3_18_1_2_1482045459111_1277">Contact Property Manager</span> </button> I can find this element with

What does double dash (--) implies in Selenium ChromeOptions

…衆ロ難τιáo~ 提交于 2021-01-27 13:02:24
问题 I am using selenium with java and I am using some chrome options with it. But I see different usages of chrome options in different sources. I mean some folks using double dash before the option and some do not (like disable-dev-shm-usage and --disable-dev-shm-usage ). Are there any differences between the two usages? 回答1: As per Command-Line Options: Unix tradition encourages the use of command-line switches to control programs, so that options can be specified from scripts. There are three

What does double dash (--) implies in Selenium ChromeOptions

做~自己de王妃 提交于 2021-01-27 12:55:54
问题 I am using selenium with java and I am using some chrome options with it. But I see different usages of chrome options in different sources. I mean some folks using double dash before the option and some do not (like disable-dev-shm-usage and --disable-dev-shm-usage ). Are there any differences between the two usages? 回答1: As per Command-Line Options: Unix tradition encourages the use of command-line switches to control programs, so that options can be specified from scripts. There are three

How to Click the “OK” Button within an Alert using Python + Selenium

心不动则不痛 提交于 2021-01-27 12:52:53
问题 I want to click the "OK" button in this pop up dialog I tried: driver.switchTo().alert().accept(); but it doesn't work 回答1: To click on the OK button within the alert you need to induce WebDriverWait for the desired alert_is_present() and you can use the following solution: WebDriverWait(driver, 10).until(EC.alert_is_present()) driver.switch_to.alert.accept() Note : You have to add the following imports : from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support

Selenium WebDriver loses connection to web page

妖精的绣舞 提交于 2021-01-27 12:45:27
问题 I'm executing an automated test with Selenium ChromeDriver against a form on a web page. When I click the Submit button on the form, my WebDriver is losing connection to the browser/page/components, etc. Any subsequent action against the page objects or the browser results in timeouts because it no longer has a connection. It's as if the submit causes the underlying connection to break. This is the error I get and it's a similar error no matter if I'm trying to click a page object, manipulate

What is the correct syntax checking the .readyState of a website in Selenium Python?

六眼飞鱼酱① 提交于 2021-01-27 12:19:03
问题 I'm trying to check the .readyState of a website using .execute_script but I keep getting an error. I'm using a pageLoadStrategy of "none" in chromedriver so I'm trying to test that the websites readystate is no longer "loading". Note: this question is Python-specific. WebDriverWait(driver, timeout=20).until( driver.execute_script('return document.readyState') == 'interactive' ) value = method(self._driver) TypeError: 'str' object is not callable I've also tried using lambda which doesn't

What is the correct syntax checking the .readyState of a website in Selenium Python?

扶醉桌前 提交于 2021-01-27 12:16:00
问题 I'm trying to check the .readyState of a website using .execute_script but I keep getting an error. I'm using a pageLoadStrategy of "none" in chromedriver so I'm trying to test that the websites readystate is no longer "loading". Note: this question is Python-specific. WebDriverWait(driver, timeout=20).until( driver.execute_script('return document.readyState') == 'interactive' ) value = method(self._driver) TypeError: 'str' object is not callable I've also tried using lambda which doesn't