waitFor and Pause Both are synchronization commands.
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.
Related Article: How To Work On Pages With AJAX In Selenium?
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.
Related Article: Commands In Context Menu - Selenium
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.
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.
Get Updates on Tech posts, Interview & Certification questions and training schedules