我正在编写用于点击链接的代码:
<a style="left: 520px; top: 340px; height: 24px; color: blue; position: absolute;" href="Login.aspx?iUserFlag=1">
文字:以其他用户身份登录?
我写的是:
Selenium.click(“link = Sign in as different user?”);
但我无法点击,有人可以提供帮助吗?
HTML Snippet就是
<A style="POSITION: absolute; HEIGHT: 24px; COLOR: blue; TOP: 340px; LEFT: 520px" href="http://kaizenblitz/Login.aspx?iUserFlag=1">Sign in as different user?</A>
执行时收到的错误信息是:
Exception in thread "main" com.thoughtworks.selenium.SeleniumException: ERROR: Element link = Sign in as different user? not found
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:109)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:103)
at com.thoughtworks.selenium.DefaultSelenium.click(DefaultSelenium.java:193)
at seleniumproject.gmail.main(gmail.java:19)
任何人都可以建议我为什么我无法点击链接?
答案 0 :(得分:0)
Selenium
是您的对象,而不是selenium
。将selenium.click("link = Sign in as different user")
更改为...
selenium.click("link=Sign in as different user")
您的测试正在寻找包含文字" Sign in as different user"
的链接(请注意开头的空格)