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.
How to click first link on a page, if links on that page is not static
Hi,
I am unable to write the script for 'clicking the first link on the page, if the link is not static (means the links of that webpage keeps on changing on a daily basis. So how to write a script for it ?
I am unable to write the script for 'clicking the first link on the page, if the link is not static (means the links of that webpage keeps on changing on a daily basis. So how to write a script for it ?
Comments
function getFirstLink(){
var list = document.getElementById("recipe-teaser");
var li = list.getElementsByTagName("li");
var aText = li[0].getElementsByTagName("a")[1].innerHTML;
_click(_link(aText));
}
but i am getting following error on execution:
_click(_link(aText));
TypeError: 'aText' is undefined
No trace available
Kindly suggest solution for this.
Regards,
Tina
_link(0)
If you want a first link inside "recipe-teaser", use
_link(0, _in(_byId("recipe-teaser")))
Also, i want to know why is my code not working. Can you please tell me.
Regards,
Tina
please reply, i am stuck in between
Regards,
Tina
_link(0, _in(_div("class_name")))
Check out "Using custom functions that access the DOM." in http://sahi.co.in/w/sahi-script-and-javascript to understand how to write the code that you had initially posted.
Regards,
Narayan
I am facing a problem while running my suite script from command prompt :
Connection refused: connect
Could not connect to Sahi Proxy.
Verify that the Sahi Proxy is running on the specified host and port.
Please help me asap.
Regards,
Tina
Still i am facing this problem.
Please create a new forum post.
You have to start Sahi before running your suite script.
Regards
Sumitra
I am unable to create a new post.
Also i tried what you said, but i am again facing Failure.
please suggest what to do.
Regards,
Tina
Regards,
Tina
I am getting what i want.
Thanks for your help.
Also can you please tell me how to create a new post, because there's only option for creating a message. Is message or post same thing?
Please reply because i have more questions to ask.
Regards,
Tina
You can create a new post by Clicking on Post new topic on the forum page.
Regards
Sumitra