18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
regular expression matching issue on popup Window
I'm still unable to use regexr to close the popup windows correctly.
Please advise.
Browser: IE6
Sahi: 20100909
What I want to do is click on my opened/clicked link, do some other stuff on that popup page then close popupWindow.
_click(_link("Link1"));
DoOtherStuffOnThatPage ();
//now close popupWindow
_popup("The title of this page is: Child1")._closeWindow(); //works
_popup("/The title of this page is: Child1/")._closeWindow(); //does not work
_popup(/The title of this page is: Child1/)._closeWindow(); //does not work
_popup("/Child1/")._closeWindow(); //does not work
_popup(/Child1/)._closeWindow(); //does not work
_popup("/^The title/")._closeWindow(); //does not work
_popup(/^The title/)._closeWindow(); //does not work
_popup("/Child1$/")._closeWindow(); //does not work
_popup(/Child1$/)._closeWindow(); //does not work
As you can see I tried with and without the quotes to use regexr above...cant seem to get this to work.
Please advise.
You can try this with your popup twitter link/button on your page sahi.co.in/w then close that popup using title of that page "Share this on Twitter"
then try the above example of regexr above...
Please advise.
Browser: IE6
Sahi: 20100909
What I want to do is click on my opened/clicked link, do some other stuff on that popup page then close popupWindow.
_click(_link("Link1"));
DoOtherStuffOnThatPage ();
//now close popupWindow
_popup("The title of this page is: Child1")._closeWindow(); //works
_popup("/The title of this page is: Child1/")._closeWindow(); //does not work
_popup(/The title of this page is: Child1/)._closeWindow(); //does not work
_popup("/Child1/")._closeWindow(); //does not work
_popup(/Child1/)._closeWindow(); //does not work
_popup("/^The title/")._closeWindow(); //does not work
_popup(/^The title/)._closeWindow(); //does not work
_popup("/Child1$/")._closeWindow(); //does not work
_popup(/Child1$/)._closeWindow(); //does not work
As you can see I tried with and without the quotes to use regexr above...cant seem to get this to work.
Please advise.
You can try this with your popup twitter link/button on your page sahi.co.in/w then close that popup using title of that page "Share this on Twitter"
then try the above example of regexr above...
Comments
Here's the solution (email from Narayan) for those with the same problem:
"A single character is represented by a . (dot)
Any number of characters is .*
You need to use:
//Title of this page is Page1
_popup("/Title .* this page is.*/")
(This is different from the other APIs, in that it needs the end .* too. For normal Sahi APIs, just _button("/Title .* this page is/") would have worked. We are looking into this.)
Regards,
Narayan"
I click on a window link to open a popup window that has a name = "2323" given automatically.
I am able to locate the pop up using
_popup("2323");
But I am not able to locate the popup using regular expression
_popup("/.*");
I get an error
_alert('pop->'+_popup("/.*/"));
SahiNotMyWindowException: Window with name [/.*/] not found
I feel somehow the the regular expression is taken as a string. I also tried
var $str = "/.*";
_popup(new RegExp($str));
that is also not working.
Could you please provide a guideline.
Regards,
Abhay
Use either:
_popup("/.*/");
or
var $str = ".*";
_popup(new RegExp($str));
Regards,
Narayan
Thanks for the quick reply.
I have tried both of them already.
In my posting I missed the "/".
Both _popup("/.*/");
&
var $str = ".*";
_popup(new RegExp($str));
are not working when I am trying to give an _alert.
What works is
_alert(_popup("2424"));
What does not work is
_alert(_popup("/.*/"));
I also tested this in the Sahi Controller-->Record Tab-->Evaluate Expression-->Test -->
I downloaded the latest version from SAHI web site and I still have the problem.
I then removed the _alert and directly reference the fields on the popup using the following
_popup("/.*/")._setValue(_textbox(4), "Hello World");
Then this started showing my original problem for which I was inserting an _alert statement.
The problem is that SAHI finds my original parent window and sets the Hello World string in the textbox(4) of that window.
It does not set it on the Popup window.
Is there any way we can indicate _popup to ignore the parent window?
Any help in this matter would be appreciated.
Regards,
Abhay