Home > other >  The selenium problems in use.
The selenium problems in use.

Time:12-02

I wrote a few words is very collapse, code, as follows, set up an implicit judgement 30 seconds

Then ind_elements_by_xpath, if you take this to the value, the value will return immediately, if not, will wait for 30 seconds in return,

This 30 seconds and I set the value of the implicit wait is the same as what circumstance, why wait??




 import time 
The from the selenium import webdriver
The from selenium.com mon. Exceptions import NoSuchElementException


Driver=webdriver. Chrome (executable_path="chromedriver. Exe") # chromedriver specified path
Driver. Implicitly_wait (30) # Settings page timeout
Driver. The get (' https://www.baidu.com/')


Print (' start validation)
Array=driver. Find_elements_by_xpath ('//* [@ id="su1"] ') # verify load test
If len (Array)==0:
Print (' no validation)
The else:
Print (' validated ')

CodePudding user response:

Driver. Implicitly_wait (30) belong to the implicit waiting, began to find elements within 30 s, 30 s was not found an error, and len (Array) this seems to be the wrong way
  • Related