Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make selenium pause for input and resume on a trigger?

I am wondering if selenium can do below? I want to automate only certain parts of the automation flow:

  1. Load a web page (built with angular), submit the form with some predefined inputs
  2. On the next page, automatically fill in some data like earlier, but wait for me to fill in some input on specific input fields (can't hard-code this data)
  3. After this, a trigger (like a button press or key combination; outside of the web page) should carry on with the rest of the automated flow and land in page 3 and 4 and so on.

The only option I am familiar with is to write and run custom JS that modifies form elements, in the browser>inspect>console. For above, I'll have to run different functions on each page. For doing this, I can comment out all but the required function call and run it. I think I cannot select and run only one part of the code (for page 1 for example) from the console.

PS: If any of the strict SO folks think this is not fitting SO, where else is a good (automation focused?) place to ask for finding the right tools for this kind of stuff?

like image 734
dbza Avatar asked Feb 03 '23 23:02

dbza


1 Answers

Note: I have used selenium via python, so solution reflects that.

Oh yeah. It's just a python script. Don't think of it in terms if selenium script. A python script can be easily made to wait for input.

print("Hi!. Script Started")
# code to load webpage, automatically fill whatever can be entered
x = input("Waiting for manual date to be entered. Enter YES when done.")
# Enter the data on page manually. Then come back to terminal and type YES and then press enter.
if x == 'YES':
    continue_script_here()
else:
    kill_script_or_something_else()
like image 122
Sahil Agarwal Avatar answered Feb 06 '23 16:02

Sahil Agarwal