webdriver-用 driver.find_element_by_link_text('退出').click()异常

问题描述

用 driver.find_element_by_link_text('退出').click()异常

问题:
python+seleniu做自动化用 driver.find_element_by_link_text('退出').click()做qq邮箱退出操作程序异常,求大神解答一下哪里有问题!

异常情况如下:
File "D:/PycharmProjects/untitled/mainTest.py", line 13, in
login().user_logout(driver)
File "D:PycharmProjectsuntitledLoginPublic.py", line 24, in user_logout
driver.find_element_by_link_text('退出').click()
File "C:Python27libsite-packagesseleniumwebdriver
emotewebdriver.py", line 282, in find_element_by_link_text
return self.find_element(by=By.LINK_TEXT, value=link_text)
File "C:Python27libsite-packagesseleniumwebdriver
emotewebdriver.py", line 712, in find_element
{'using': by, 'value': value})['value']
File "C:Python27libsite-packagesseleniumwebdriver
emotewebdriver.py", line 201, in execute
self.error_handler.check_response(response)
File "C:Python27libsite-packagesseleniumwebdriver
emoteerrorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException

Process finished with exit code 1

解决方案

这个是因为浏览器没有找到element的原因。
没有找到element的话,大概有几个原因:
1.确认是否存在这个元素。它的link_text是不是“退出”两个字。
2.观察一下浏览器,看看是不是这个元素没有加载出来。

解决方案二:

Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'xml-bod
[Repost]Selenium ElementNotVisibleException: Cannot click on element
media in the link element -CSS and select by #id

解决方案三:

http://blog.csdn.net/intel80586/article/details/8783279

时间: 2024-10-29 21:43:28

webdriver-用 driver.find_element_by_link_text('退出').click()异常的相关文章

javascript-jquery如何设置一个动态创建的 $('#').append('')中的ID?并利用它

问题描述 jquery如何设置一个动态创建的 $('#').append('')中的ID?并利用它 就比如像这样的: <script type="text/javascript"> var number=0; function next(){ $('#showdata').append('<input class="number_showdata" id="showdataid'+number+'" type="tex

请求-求助啊!!var id=$(this).attr(&amp;amp;#39;id&amp;amp;#39;); 和 $(this).empty(); 怎么结合

问题描述 求助啊!!var id=$(this).attr('id'); 和 $(this).empty(); 怎么结合 已经获得各个id ... $(document).ready(function(){ $('div').click(function(){ var id=$(this).attr('id'); alert(id); //可以得到某个id的值 var aurl=""<%=basePath%>/colV.action""; var ada

mongodb-MongoDB 3.0 Java Driver在Linux Server下多线程插入数据异常

问题描述 MongoDB 3.0 Java Driver在Linux Server下多线程插入数据异常 使用MongoDB 3.0版本,部署环境为vSphere构建虚拟机,使用Java driver(3.0.0rc1)多线程写入数据到MongoDB,异常信息如下所示: Caused by: java.lang.NullPointerException at com.mongodb.connection.ProtocolHelper.isCommandOk(ProtocolHelper.java:

jsp-[Microsoft][ODBC SQL Server Driver][SQL Server]用户 &amp;amp;#39;huyaozhong&amp;amp;#39; 登录失败。18456

问题描述 [Microsoft][ODBC SQL Server Driver][SQL Server]用户 'huyaozhong' 登录失败.18456 <% String url = "jdbc:odbc:Temdata"; String username = "huyaozhong"; String password = "123456"; Connection con = null; try{ out.println("

sessionfactory-No bean named &amp;amp;#39;sessionFactory&amp;amp;#39; is defined

问题描述 No bean named 'sessionFactory' is defined 在加入spring security之后出现了下面的问题 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCrea

namespace-error C2248: &amp;amp;#39;Num&amp;amp;#39; : cannot access private ......

问题描述 error C2248: 'Num' : cannot access private ...... #include #include #include #include using namespace std; class worker{ string Num; //职工号 string Nam; //姓名 string Pen; //性别 int Age; //年龄 double Sal; //工资 public: worker(string="#",string=&qu

Unknown column &amp;#39;*&amp;#39; in &amp;#39;field list&amp;#39; 异常解决

在使用Hibernate做持久化的时候,为实体类定义一个与数据表无关的属性. 出现异常如下: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'user0_.authority' in 'field list' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.Native

spring- No bean named &amp;amp;#39;shiroFilter&amp;amp;#39; is defined

问题描述 No bean named 'shiroFilter' is defined 要把shiro整合进入spring出现了这个错误,'shiroFilter' 这个bean已经定义过了的着急在线等.. 严重: Exception starting filter shiroFilterorg.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'shiroFilter' is defined w

tomcat-spring问题,急!!!Property &amp;amp;#39;sqlMapClient&amp;amp;#39; is required

问题描述 spring问题,急!!!Property 'sqlMapClient' is required 用Struts2+spring做项目时,在Tomcat上部署运行出现org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'registerService' defined in file [C:Usersmacjeeworkspace.metadata.pluginso