开发者

wait for an link to appear which is already in the page in selenium

开发者 https://www.devze.com 2023-04-08 04:21 出处:网络
Hi i am using selenium with testng. I have created a code in which i will login to a website and then after that their is a operation that happ开发者_运维百科ens and it collects the name of all the ip

Hi i am using selenium with testng. I have created a code in which i will login to a website and then after that their is a operation that happ开发者_运维百科ens and it collects the name of all the ip addresses range given and after scanning their is a link that appears called SCAN COMPLETE. Now i have to wait for such link and after that i will logout.I use

selenium.waitforElemenPresent("link=SCAN COMPLETED");

Since on page this element is already present but hidden so it doesn't works. So i need to wait for such link to appear on the screen and after that i logout.

Any suggestions.


I assume you are using Selenium RC. One option is to wait for the element using XPath. This way you can also check for the display attribute.

So say the link looks something like this (notice the display attribute):

<a href="#" style="display: none">SCAN COMPLETE</a>

You can wait for it to be visible with:

selenium.waitForElementPresent("//a[text()='SCAN COMPLETE' and not(contains(@style, 'display: none'))]");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号