Python中文
首页
教程
问答
标签
搜索
登录
注册
无法使用selenium webdri在网页中单击链接
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我想用selenium python webdriver在我的路由器网页上点击“无线”链接。以下是html:</p> <pre><code> <html> <head> <frameset framespacing="0" frameborder="0" border="0" rows="50,*,15"> <frame noresize="" marginheight="0" marginwidth="0" target="_self" scrolling="no" border="0" frameborder="no" name="logofrm" src="logo.html"> <frameset border="0" frameborder="0" cols="170,*"> <frame noresize="" marginheight="0" marginwidth="0" target="_self" scrolling="no" border="0" frameborder="no" name="menufrm" src="menu.html"> <html> <head> <body class="mainMenuBody" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0"> <table cellspacing="0" cellpadding="0" border="0" height="100%"> <tbody> <tr> <td width="1" style="background-color: #C35822"></td> <td class="menu" width="170" valign="top" align="left"> <br> <script language="javascript"> <div id="folder0"> <div id="folder1" style="display: block;"> <div id="folder2" style="display: none;"> <div id="folder3" style="display: none;"> <div id="folder4" style="display: none;"> <div id="item5" style="display: none;"> <div id="item6" style="display: none;"> <div id="item7" style="display: none;"> <div id="item8" style="display: none;"> <div id="folder9" style="display: none;"> <div id="folder10" style="display: none;"> <div id="folder11" style="display: none;"> <div id="folder12" style="display: block;"> <div id="folder13" style="display: none;"> <div id="item14" style="display: none;"> <div id="item15" style="display: none;"> <div id="item16" style="display: none;"> <div id="folder17" style="display: none;"> <div id="item18" style="display: none;"> <div id="folder19" style="display: none;"> <div id="item20" style="display: none;"> <div id="item21" style="display: none;"> <div id="item22" style="display: none;"> <div id="folder23" style="display: none;"> <div id="folder24" style="display: none;"> <div id="item25" style="display: none;"> <div id="item26" style="display: none;"> <div id="folder27" style="display: none;"> <div id="folder28" style="display: none;"> <div id="folder29" style="display: none;"> <div id="folder30" style="display: none;"> <div id="folder31" style="display: none;"> <div id="folder32" style="display: none;"> <div id="item33" style="display: none;"> <div id="item34" style="display: none;"> <div id="folder35" style="display: none;"> <div id="item36" style="display: none;"> <div id="item37" style="display: none;"> <div id="item38" style="display: none;"> <div id="item39" style="display: none;"> <div id="folder40" style="display: none;"> <div id="item41" style="display: none;"> <div id="item42" style="display: none;"> <div id="folder43" style="display: none;"> <div id="folder44" style="display: none;"> <div id="folder45" style="display: none;"> <div id="folder46" style="display: none;"> <div id="folder47" style="display: none;"> <div id="item48" style="display: none;"> <div id="item49" style="display: none;"> <div id="item50" style="display: none;"> <div id="item51" style="display: none;"> <div id="folder52" style="display: none;"> <div id="folder53" style="display: block;"> <table cellspacing="2" cellpadding="0" border="0" width="100%"> <tbody> <tr> <td class="menuCell" width="100%" valign="middle" nowrap=""> <a class="menuLink" onclick="javascript:clickOnFolder(53)" target="basefrm" href="wlswitchinterface0.wl"> Wireless </a> </td> </tr> </tbody> </table> </div> <div id="item54" style="display: block;"> <div id="item55" style="display: block;"> <div id="item56" style="display: block;"> <div id="item57" style="display: block;"> <div id="item58" style="display: block;"> <div id="item59" style="display: block;"> <div id="folder60" style="display: block;"> <div id="folder61" style="display: block;"> <div id="folder62" style="display: none;"> <div id="item63" style="display: none;"> <div id="item64" style="display: none;"> <div id="item65" style="display: none;"> <div id="folder66" style="display: none;"> <div id="folder67" style="display: none;"> <div id="folder68" style="display: none;"> <div id="folder69" style="display: none;"> <div id="folder70" style="display: none;"> <div id="item71" style="display: none;"> <div id="item72" style="display: none;"> <div id="folder73" style="display: none;"> <div id="folder74" style="display: none;"> <div id="folder75" style="display: none;"> <noscript>You must enable JavaScript in your browser.</noscript> </td> <td width="1" style="background-color: #C35822"></td> <td style="background-color: #ffffff"></td> </tr> </tbody> </table> </body> </html> </frame> <frame noresize="" marginheight="16" marginwidth="0" target="_self" scrolling="auto" border="0" frameborder="no" name="basefrm" src="info.html"> </frameset> <frame noresize="" marginheight="0" marginwidth="0" target="_self" scrolling="no" border="0" frameborder="no" name="footerfrm" src="footer.html"> </frameset> </html> </code></pre> <p>我的脚本中有以下一行:</p> ^{pr2}$ <p>但它不起作用,而且会引发无谓的异常</p> <blockquote> <p>NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"//a[@href=\"wlswitchinterface0.wl\"]"}</p> </blockquote>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>问题似乎出在引语上。使用以下语法:</p> <pre><code>driver.find_element_by_xpath("//a[@href='wlswitchinterface0.wl']").click() </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何将Python中的列表复制到给定的目标中?
5 回答
如何将python中的列表插入SQL表
9 回答
如何将python中的列表转换为numpy数组以放入十位
8 回答
如何将python中的列表输入javascript?
7 回答
如何将python中的列表返回给dag?
6 回答
如何将Python中的列表项重新排列成成对的元组/列表?
7 回答
如何将Python中的初始化对象序列化为XML?
9 回答
如何将python中的十进制字符串转换为数字?
5 回答
如何将Python中的原始输入文本转换为Tkinter中的标签?
8 回答
如何将python中的反斜杠命令转换为在Linux上运行
3 回答
如何将python中的命令行参数转换为字典?
3 回答
如何将python中的图像值传递到kivy中的kv文件?
7 回答
如何将Python中的图像数组(枕头对象)上传到Google云
10 回答
如何将Python中的图像编码为Base64?
1 回答
如何将python中的图像调整为灰度低分辨率,如MNIST时尚数据?
3 回答
如何将python中的多个html输出保存到单个文件(或多个)中?
2 回答
如何将Python中的多个ifelse语句重构为一个函数?
3 回答
如何将Python中的多处理与Django结合使用,从xml文件创建数千个模型实例?
8 回答
如何将python中的多级API响应转换为dataframe
2 回答
如何将python中的多线程编程模型转换为异步/等待模型?
7 回答