What is the difference between browser.sleep () and browser.wait () methods?

Problems with synchronization with the protractor. sometimes due to network issues or performance issues due to problems with my draws. I decided to solve the existing problems with browser.sleep (). Later I found out about browser.wait ().

What is the difference between the two, and which is better for solving network or performance issues.

+4
source share
3 answers

When it comes to solving the synchronization problem, it is tempting and easy to set up a β€œfast” browser.sleep () and move on.

, - . / , - , , , - - , , .. , , , .

browser.wait(), -. Protractor/WebDriverJS , true. , .

, ( ).

+5

browser.sleep()

, .

browser.wait()

.

This function blocks the WebDriver control flow, not javascript runtime. This only delays the execution of future webdriver commands (for example, it will make Protractor wait before sending future commands to the selenium server) and only when the webdriver control flow is enabled.

Documentation link http://www.protractortest.org/#/api

+2
source

Source: https://habr.com/ru/post/1683316/


All Articles