开发者

breakdown xpath

I am looking at the website. Trying to transfer selenium html to junit but could not get it to work because it keeps saying Error: Element not found. Maybe syntax error because I was able to break it down to the shortest path in firebug but still could not get to compile..What do you do in this case ?

Enrollment

I use firebug Xpath to get the value of the above link /html/body/div[@id='contentDisplayPane']/div[@id='mainDiv']/div[@id='mainDivContent']/div[@id='simpleBox']/table/tbody/tr[2]/td[@id='fb_PageContent']/table/tbody/tr/td/table/tbody/tr/td[4]/a

Using firebug xpath, I was able to break it down to this 开发者_StackOverflowand able to access Enrollment link..However when I put this in the junit test case selenium.click(("//div[@id='simpleBox']/table/tbody/tr[2]/td[@id='fb_PageContent']/table/tbody/tr/td/table/tbody/tr/td[4]/a"); I get ERROR: Element //div[@id='simpleBox']/table/tbody/tr[2]/td[@id='fb_PageContent']/table/tbody/tr/td/table/tbody/tr/td[4]/a") not found

Any help or tip is appreciated


Hey If you want to click any Link on your web page. You have to first find Xpath of this Element/Text, For this you can use Firebug.So here an ex: You can use in IDE selenium.click(//a[text()="ON"]) and convert it to junit and get this selenium.click("//a[text()=\"HereYouCanPutYourText\"]");

please feel free if you have any concern..


Are the tbody elements actually in the html or just being inserted by Firefox? If Firefox is inserting the tbody and your junit tests are driving a different browser, the tbody might not be there. Just a shot in the dark since you didn't post the document you're testing, but maybe it'll help.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜