Reset the driver execution state to a particular point in test case - Selenium

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Reset the driver execution state to a particular point in test case - Selenium

Kesiya Abraham

I am trying to achieve the reset functionality in test cases where the automation tool used is selenium.

The scenario is, I have a test case,

  1. Go to the URL specified
  2. Type username and password fields
  3. Click on submit button
  4. Type 'some value' in a textbox
  5. Click on a button
  6. Pop up a window
  7. Check the title

Here, I have to make a retry on the commands starting from step 4 to step 7. Suppose, I have to retry these commands 2 times and once the control goes to step 7 and title is not present, I have to reset the driver execution status exactly to point step 4 and should be able to retry the same steps again.

I am not able to find a reset command from selenium documentation. Could anyone please help me to achieve the same?

Thanks in advance for all comments!

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/dde2813c-f5d8-48b8-a92c-882f2818d58ao%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Reset the driver execution state to a particular point in test case - Selenium

Adrian-2

Hi Keyisa,
What are you trying to achieve?
It sounds like the title is not present after you have performed some steps, so you want to do the exact same thing again and check to see if the title matches.
Is that what you are doing?

If this is true, then I think you have timing issue.  If the pop up window exists then it should have a title otherwise the test should fail.
If the test fails and you can see a title on the pop up then in step 7 you need to wait until the title exists.  If after your wait time the title does not exist or is incorrect, then fail the test.

Restarting from step 4 sounds like the wrong thing to do.

Regards,
Adrian.


On Wednesday, 1 July 2020 00:26:21 UTC+10, Kesiya Abraham wrote:

I am trying to achieve the reset functionality in test cases where the automation tool used is selenium.

The scenario is, I have a test case,

  1. Go to the URL specified
  2. Type username and password fields
  3. Click on submit button
  4. Type 'some value' in a textbox
  5. Click on a button
  6. Pop up a window
  7. Check the title

Here, I have to make a retry on the commands starting from step 4 to step 7. Suppose, I have to retry these commands 2 times and once the control goes to step 7 and title is not present, I have to reset the driver execution status exactly to point step 4 and should be able to retry the same steps again.

I am not able to find a reset command from selenium documentation. Could anyone please help me to achieve the same?

Thanks in advance for all comments!

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e724b159-82b5-41ec-95a7-46a81b987483o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Reset the driver execution state to a particular point in test case - Selenium

Gaurav Pandey
In reply to this post by Kesiya Abraham
You probably may want to consider using text fixtures - TestNg and Junit are quite popular. 
For instance in Junit - 

@Before All
<<code for launch and login>>

test()
<<code for the test

@AfterEach
<<code for log off and exit browser>>

if you follow the above structure - @AfterEach will run irrespective of whatever is the status of test()

in Java, the concept of BaseTest is quite popular as well.

Do consider. 


On Tuesday, June 30, 2020 at 7:56:21 PM UTC+5:30, Kesiya Abraham wrote:

I am trying to achieve the reset functionality in test cases where the automation tool used is selenium.

The scenario is, I have a test case,

  1. Go to the URL specified
  2. Type username and password fields
  3. Click on submit button
  4. Type 'some value' in a textbox
  5. Click on a button
  6. Pop up a window
  7. Check the title

Here, I have to make a retry on the commands starting from step 4 to step 7. Suppose, I have to retry these commands 2 times and once the control goes to step 7 and title is not present, I have to reset the driver execution status exactly to point step 4 and should be able to retry the same steps again.

I am not able to find a reset command from selenium documentation. Could anyone please help me to achieve the same?

Thanks in advance for all comments!

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b0afd243-98d9-4b78-b97e-d83d85c0d604o%40googlegroups.com.