【发布时间】:2017-09-15 08:21:23
【问题描述】:
<h2>Account Management</h2>
<table class="form-table">
<tr id="password" class="user-pass1-wrap">
<th><label for="pass1">New Password</label></th>
<td>
<input class="hidden" value=" " /><!-- #24364 workaround -->
<button type="button" id="wp-generate-pw" class="button button-
secondary wp-generate-pw hide-if-no-js">Generate Password</button>
<div class="wp-pwd hide-if-js">
<span class="password-input-wrapper">
在上面的源代码中,我想找到 id 为“id='wp-generate-pw”的按钮。 我试图通过 xpath 定位
classButtonXpath= "//*[@id='wp-generate-pw']"
siteClassNameElement = self.driver.find_element_by_xpath(classButtonXpath)
siteClassNameElement.click()
但我收到以下错误:NoSuchElementException: 消息:没有这样的元素:无法找到元素:{"method":"xpath","selector":"//*[@id='wp-generate-pw ']"
我尝试了很多方法,但还是找不到
有什么想法吗? 谢谢
【问题讨论】:
标签: selenium