implicitwait

Why does Selenium get the child elements slowly

可紊 提交于 2021-01-29 02:13:21
问题 For example, HTML: <input type="hidden" name="ie" value="utf-8"> this element don't have child element, when I use code: List<WebElement> childElements = ele.findElements(By.xpath("./*")); the program uses a very long time (about 30s) return a result. And the result size is right which is zero. So how can I resolve this problem? Thanks. 回答1: As per the documentation findElements() method is affected by the implicit wait duration in force at the time of execution. When implicitly waiting,

selenium implicitly wait doesn't work

孤人 提交于 2019-11-30 09:39:08
问题 This is the first time I use selenium and headless browser as I want to crawl some web page using ajax tech. The effect is great, but for some case it takes too much time to load the whole page(especially when some resource is unavailable),so I have to set a time out for the selenium. First of all I tried set_page_load_timeout() and set_script_timeout() ,but when I set these timeouts, I won't get any page source if the page doesn't load completely, as the codes below: driver = webdriver

Python & Selenium: Difference between driver.implicitly_wait() and time.sleep()

痞子三分冷 提交于 2019-11-30 06:05:21
问题 Yes, I know both are used to wait for some specified time. Selenium: driver.implicitly_wait(10) Python: import time time.sleep(10) Is there any difference between these two? 回答1: time.sleep(secs) time.sleep(secs) suspends the execution of the current thread for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time. The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following

selenium implicitly wait doesn't work

元气小坏坏 提交于 2019-11-29 16:06:09
This is the first time I use selenium and headless browser as I want to crawl some web page using ajax tech. The effect is great, but for some case it takes too much time to load the whole page(especially when some resource is unavailable),so I have to set a time out for the selenium. First of all I tried set_page_load_timeout() and set_script_timeout() ,but when I set these timeouts, I won't get any page source if the page doesn't load completely, as the codes below: driver = webdriver.Chrome(chrome_options=options) driver.set_page_load_timeout(5) driver.set_script_timeout(5) try: driver.get

Python & Selenium: Difference between driver.implicitly_wait() and time.sleep()

空扰寡人 提交于 2019-11-28 14:35:50
Yes, I know both are used to wait for some specified time. Selenium: driver.implicitly_wait(10) Python: import time time.sleep(10) Is there any difference between these two? time.sleep(secs) time.sleep(secs) suspends the execution of the current thread for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time. The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal’s catching routine. Also, the suspension time may be longer than requested by an

How to properly configure Implicit / Explicit Waits and pageLoadTimeout through Selenium?

Deadly 提交于 2019-11-27 05:42:07
I currently have the following setup, but I'm not sure that my waits (Implicit and pageLoadTimeout) are working. Is this the proper implementation? By putting it in the @Before("@setup"), does it work for every Scenario or Step Definition run? Will the driver wait accordingly, everytime I call a @Given, @When..etc? @Before("@setup") public void setUp() { driver.manage().deleteAllCookies(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS); } Why is it necessary to assign a WebElement to the following wait , what

How to combine implicit and explicit timeouts in Selenium?

▼魔方 西西 提交于 2019-11-26 23:42:00
问题 I am using Selenium ChromeDriver with an implicit timeout: _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); In one of my tests I want to override this with an explicit timeout. Before reading a property I explicitely wait for the element to be found: WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(120)); wait.Until(d => d.FindElement(By.CssSelector("div.example"))); I would expect this to take 120s to try to find the element, but it times out after just

Using implicit wait in selenium

老子叫甜甜 提交于 2019-11-26 08:58:00
I am a beginner. I understand what waits basically does but I am confused over how different tutorials over the internet place it and explain it. For example, in the below code it is placed before loading the URL. So, is it only to wait for the URL to be loaded or for finding the element or both? Is is true that if I use an implicit wait once in my try block, it will be applicable for every element search I am performing in my code? from selenium import webdriver driver = webdriver.Firefox() driver.implicitly_wait(10) # seconds driver.get("http://somedomain/url_that_delays_loading")

How to properly configure Implicit / Explicit Waits and pageLoadTimeout through Selenium?

一个人想着一个人 提交于 2019-11-26 08:38:06
问题 I currently have the following setup, but I\'m not sure that my waits (Implicit and pageLoadTimeout) are working. Is this the proper implementation? By putting it in the @Before(\"@setup\"), does it work for every Scenario or Step Definition run? Will the driver wait accordingly, everytime I call a @Given, @When..etc? @Before(\"@setup\") public void setUp() { driver.manage().deleteAllCookies(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().timeouts()