Why reptile study notes To set the timeout, how to set (using selenium)

  A program is not set timeout, we can say that was a flawed code.

  Read Timeout refers to the client's server sends a request waiting time. (Specifically, it means that the client waits for the server to transmit the time between bytes at 99.9% of cases this means that the time before the server sends the first byte).

  Simply put, it is to initiate a connection timeout requests a connection to the maximum time to establish the connection between the read timeout is the maximum time the connection between the server returns a successful start to wait for the response.

 

***************************************************************************************************************************************************

  Page elements waiting to be processed.

显性等待:
EC.presence_of_element_located((By.ID,"acdid"))
util.browser.find_element_by_id("acdid").click()
Forced to wait: 
can sleep (3), but not the best approach

Recessive wait: # recessive wait for up to 30 seconds,
driver.implicitly_wait(30) # 隐性等待和显性等待可以同时用,但要注意:等待的最长时间取两者之中的大者


******************************************************************************************************************************************

   Tortured souls from 1: do not set the timeout, why not affected?

  Even if you do not set a timeout period, under normal circumstances, an HTTP request always returns the result, even though it may be time-consuming. For a service load is not high, the potential problem is not exposed.

 


  Tortured soul from 2: Under what circumstances, do not set the timeout will cause serious impact?

  (1) associated with the operation of the user interface if you do not set the timeout, there will be no response for a long time, seriously affecting the user experience.

  (2) high load on the system, because a lot of time-consuming long call interfaces, leading to a sharp decline in performance, thus affecting other normal business .
  (3) some cases, HTTP requests may never get a response, then this part of the system resources has been occupied until the system Ben collapse.

 

Guess you like

Origin www.cnblogs.com/lumc5/p/11762589.html