Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wait for user action

I am looking for a solution, if it is possible to wait for the data entered by the user in protractor.

I mean test stop for a while and I can enter some value and then these data are used in further tests.

I tried to use javascript prompt, but I did not do much, maybe it is possible to enter data in OS terminal?

Please give me an example if it is possible.

like image 758
tealang Avatar asked May 29 '26 03:05

tealang


1 Answers

I would not recommend mixing the automatic and manual selenium browser control.

That said, you can use Explicit Waits to wait for certain things to happen on a page, e.g. you can wait for the text to be present in a text input, or an element to become visible, or a page title to be equal to something you expect, there are different ExpectedConditions built-in to protractor and you can easily write your own custom Expected Conditions to wait for. You would have to set a reasonable timeout though.


Alternatively, you can pass the user-defined parameters through browser.params, see:

  • How can I use command line arguments in Angularjs Protractor?

Example:

protractor my.conf.js --params.login.user=abc --params.login.password=123

Then, you can access the values in your test through browser.params:

var login = element(by.id("login"));
login.sendKeys(browser.params.login.user);
like image 134
alecxe Avatar answered May 31 '26 21:05

alecxe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!