在我下面的html代码中:
<div class="collapse navbar-collapse" id="b-menu-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="/accounts/login/">Sign In</a></li>
<li><a href="/accounts/signup/">Sign Up</a></li>
{% if request.user.is_authenticated or logged_in %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="glyphicon glyphicon-user"></span><b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/accounts/manageAccount/">Manage Account</a></li>
<li><a href="/accounts/createProfile/">create profile</a></li>
<li><a href="/accounts/viewProfile/">view profile</a></li>
<li><a href="/accounts/editProfile/">edit profile</a></li>
<li><a href="/accounts/logout/" id="logout">Log out</a></li>
</ul>
</li>
<li data-toggle="modal" data-target="#my-modal-box" class="active">
<a href="#"><span class="glyphicon glyphicon-search"> Search</a></li>
</ul>
</div>
我想选择注销按钮,它实际上出现在导航栏的选择器中。在
我试着通过名字,身份证等来获取元素,但是没有成功。在
^{pr2}$我显式地在注销的a href链接中添加了id,但无法获取元素。有什么建议我怎样才能得到注销元素
我得到以下例外:
NoSuchElementException: Message: u'Unable to locate element: {"method":"id","selector":"logout"}' ; Stacktrace:
at FirefoxDriver.prototype.findElementInternal_ (file:///tmp/tmpPHM5S7/extensions/fxdriver@googlecode.com/components/driver_component.js:8905)
at FirefoxDriver.prototype.findElement (file:///tmp/tmpPHM5S7/extensions/fxdriver@googlecode.com/components/driver_component.js:8914)
at DelayedCommand.prototype.executeInternal_/h (file:///tmp/tmpPHM5S7/extensions/fxdriver@googlecode.com/components/command_processor.js:10884)
at DelayedCommand.prototype.executeInternal_ (file:///tmp/tmpPHM5S7/extensions/fxdriver@googlecode.com/components/command_processor.js:10889)
at DelayedCommand.prototype.execute/< (file:///tmp/tmpPHM5S7/extensions/fxdriver@googlecode.com/components/command_processor.js:10831)
从Selenium / Firefox: Command ".click()" doesn't work with a found element得到这个
您是否尝试过使用从UI选择支持(类selenium.webdriver.support.选择。选择(webelement))?在
我不太了解Python,所以我的例子是用Java编写的:
相关问题 更多 >
编程相关推荐