Closed Keonik1 closed 1 year ago
Script actions run in the context of the test actor process, not the browser, that's why the error says "window" is not defined
. To run a script in the browser, you must use the ExecuteScript
keyword, something like this:
- action: org.getopentest.selenium.ExecuteScript
args:
script: |
return window.frames[0].name;
- script: $log("The frame name is " + $output.result)
Thanks, I'll try it in a couple of days, if everything goes well, I'll close the issue
Thanks, it worked!
If someone tries to copy, you may not be able to work, since the correct command for taking the name in my case is: return window.frames.name;
Maybe you will also have
I don't understand how to call the code that I checked in the browser console. Example: I want to output the name of the current frame. In the temple, I open
f12
->console
and enter:window.frames.name
and in response I getmy_name
.How to achieve the same effect in opentest?
I tried:
and
script: $log(window.frames.name);
but it doesn't work, I get an error:Could you write an example for this use?