Equivalent Java code of Sahi script: _openWindow("http://www.google.com","defaultSahiPopup",[360,640]);

StackOverflow https://stackoverflow.com/questions/16645350

  •  30-05-2022
  •  | 
  •  

Question

I have modified "controller.mode=sahi" at sahi.properties file as "controller.mode=java" for recording Java code in Sahi Web Test Automation Tool. I want to record my tests using with Resolution of browser (for example, 360x640). During recording the tests with resolution of 360x640, I did the following:

  1. I filled up "Enter start URL" text field as http://www.google.com
  2. I checked "Use with Resolution" check box and enter 360x640
  3. Click Go button

After recording I found the following code on Sahi Controller:

_openWindow("http://www.google.com","defaultSahiPopup",[360,640]); _selectWindow("defaultSahiPopup");

But unfortunately, the above code is not Java code. It is Sahi script I think. I need Java code in Sahi for opening the browser with the specific Resolution. What's the java code for that?

Was it helpful?

Solution

With the help of Srini from Tyto Software (http://sahi.co.in/), I have got the solution. Equivalent java code for the above sahi script is as below:

browser.execute("_sahi._openWindow('http://www.google.com','defaultSahiPopup',[360,640]);");
browser.execute("_sahi._selectWindow('defaultSahiPopup');");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top