Hurry! 20% Off Ends SoonRegister Now

Synchronisation commands - SELENIUM

waitFor and Pause  Both are synchronization commands.

waitForPageToLoad(timeout)

Arguments:

  • timeout – a timeout in milliseconds, after which this command will return with an error

Waits for a new page to load.

You can use this command instead of the “AndWait” suffixes, “clickAndWait”, “selectAndWait”, “typeAndWait” etc. (which are only available in the JS API).
Selenium constantly keeps track of new pages loading, and sets a “newPageLoaded” flag when it first notices a page load. Running any other Selenium command after turns the flag to false. Hence, if you want to wait for a page to load, you must wait immediately after a Selenium command that caused a page-load.
Pause:


pause(waitTime)

Arguments:

  • waitTime – the amount of time to sleep (in milliseconds) Wait for the specified amount of time (in milliseconds).

Difference

If pages loads before the time it will continue to next step.
Pause:—Will pause test until the specified time

Pausing test in the middle

If you want to pause test case in middle follow the below steps:
Let’s say there are 6 commands in your script and you want to pause your script at 3rd command.
Right click on command 3 and select Toggle/Break Point. Automatically you can see pause symbol in the test case pane. Your test will be paused at command 3. If you want to remove the pause repeat the same step. Pause symbol should be removed.

MindMajix YouTube Channel

Set/Clear Start Point

If you want to execute a script from middle follow below steps:
Let’s say there are 6 commands in your script and you want to start your script from 3rd command.
Right click on command 3 and select set/clear start point. Automatically you can see RUN Symbol in the test case pane. If you start running the script. Your test will be start running from command 3. If you want to remove the start point repeat the above step. RUN symbol should be removed.

Checkout Selenium Interview Questions

Execute script from specific point

If you want to execute a single command in script from middle follow below steps:
Let’s say there are 6 commands in your script and you want to execute 3rd command.
Right click on command 3 and select Execute this command. Automatically that command will be executed. Or you can double click on that command. Command will be executed

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
Selenium Training Dec 21 to Jan 05View Details
Selenium Training Dec 24 to Jan 08View Details
Selenium Training Dec 28 to Jan 12View Details
Selenium Training Dec 31 to Jan 15View Details
Last updated: 03 Apr 2023
About Author

 

Madhuri is a Senior Content Creator at MindMajix. She has written about a range of different topics on various technologies, which include, Splunk, Tensorflow, Selenium, and CEH. She spends most of her time researching on technology, and startups. Connect with her via LinkedIn and Twitter .

read less
  1. Share:
Selenium Articles