开发者

Please provide selenium rc code [duplicate]

开发者 https://www.devze.com 2023-03-13 13:15 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: XPATH or css in selenium RC
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

XPATH or css in selenium RC

I am trying to automate the below scenario in selenium rc using java:

1.open google page 2.开发者_如何学编程enter software in search text box 3.click on search button 4.from the resultant google result, click on the first link

I am trying to use xpath or css for clicking on link, but unable to succeed. the same xpath and css work fine in selenium ide but fail in rc

can someone please help me and try to automate the above scenario and please share the code.

Thanks for your time


Try the below code:

public class SampleTest extends SeleneseTestCase{ @Test public void sampleTest() throws Exception { setUp("http://www.google.com","*iexplore"); selenium.windowMaximize(); selenium.windowFocus(); selenium.open("/"); selenium.type("q", "Software"); selenium.click("btnG"); selenium.waitForPageToLoad(""); for (int second = 0;; second++) { if (second >= 60) fail("timeout"); try { if (selenium.isElementPresent("link=Computer software - Wikipedia, the free encyclopedia")) break; } catch (Exception e) {} Thread.sleep(1000); }

    selenium.click("link=Computer software - Wikipedia, the free encyclopedia");

}

}

0

精彩评论

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

关注公众号