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.
Open multiple URLs on Single Browser
Hi All,
I have a text file, containing multiple URLs. For example:
www.google.com
www.gmail.com
www.yahoo.com
All this URLs are written on a text file. I want to open these URLs on a browser, one by one.
Like, once I set URL www.google.com and press ENTER, once it is loaded completely, I set another URL and press ENTER ... and so....
Is this possible using Sahi? If yes then How?
regards,
nagar
I have a text file, containing multiple URLs. For example:
www.google.com
www.gmail.com
www.yahoo.com
All this URLs are written on a text file. I want to open these URLs on a browser, one by one.
Like, once I set URL www.google.com and press ENTER, once it is loaded completely, I set another URL and press ENTER ... and so....
Is this possible using Sahi? If yes then How?
regards,
nagar
Comments
_readFile API is used to read the file and return the content of the file as single string.
Once you have got the string, you can split it based upon the delimiter newline character(\n).
I have tried the following script with
http://sahi.example.com/_s_/dyn/Driver_initialized?browserType=chrome url. It works fine for me.
Try with the following script,
and iam able to navigate between various url specified in txt file.
Hope this might help you.
Regards,
Theeran.
Thanks for the response.
Unfortunately, I am not able to understand your code. These lines are confusing me: However, I tried in this way.
Using controller, when I set the URL as http://www.google.com/ and then try to run above code.
It joins the first URL of the txt file (www.gmail.com) and henceforth, gives error.
So, after running the code, in the url bar, url becomes, http://www.google.co.in/www.gmail.com
Kindly help in this issue.
Unless a URL starts with http:// or /, it will be treated as a relative URL. This is the correct URL resolution behaviour. You just need to use _navigateTo("http://"+$lines[$i]).
Try with the following script,
This might help you.
Regards,
Theeran.
Thanks a lot. Now it is working fine.
But, now I am getting strange error on the log file. websites which take longer time to load (like, yahoo/ndtv), are throwing this kind of error.
My Text file contains below urls:
www.cyberoam.com
www.yahoo.com
www.google.com
www.ndtv.com
www.timesofindia.com
www.google.com
Please help in this matter.