我现在定义成这样了
@classmethod
def find_toast(cls, message, timeout, poll_frequency, driver):
element = WebDriverWait(driver, timeout, poll_frequency).until(method(Driver().get_driver()), expected_conditions.presence_of_element_located((By.PARTIAL_LINK_TEXT, message)))
print element
不报那个错了,报了别的错
Error
Traceback (most recent call last):
File "E:\Users\Administrator\PycharmProjects\Shuangshi_AppiumDemo\Test\TestMyWork\TestMyWorkScripts.py", line 208, in test_19_Question_Check
RES.find_toast(u"无语音解析",5, 1, self.driver)
File "E:\Users\Administrator\PycharmProjects\Shuangshi_AppiumDemo\Test\TestMyWork\TestMyWorkScripts.py", line 69, in find_toast
element = WebDriverWait(driver, timeout, poll_frequency).until(expected_conditions.presence_of_element_located((By.PARTIAL_LINK_TEXT,message)))
File "C:\Python27\lib\site-packages\selenium\webdriver\support\wait.py", line 71, in until
value = method(self._driver)
File "C:\Python27\lib\site-packages\selenium\webdriver\support\expected_conditions.py", line 59, in __call_
return _find_element(driver, self.locator)
File "C:\Python27\lib\site-packages\selenium\webdriver\support\expected_conditions.py", line 278, in _find_element
raise e
WebDriverException: Message: Invalid locator strategy: partial link text
@xdlhy
楼主 这个参数怎么传啊
我这样传报错啊 Find_Toast.find_toast(message, 2000, 1, driver)
提示错误 TypeError: find_toast() takes exactly 4 arguments (5 given)
#34 楼 @fengcanfly 我是完全按照楼主的方法弄得 是可以并行的
#1 楼 @tobecrazy 可以啊
#3 楼 @seveniruby
npm install -g appium 只用这个命令的话 是不是没有 appium 客户端
npm install wd 这句话是安装客户端的么
应该是苹果手机输入法中自带图片的问题吧 之前我也遇到过带图片的昵称在某些功能上有问题
#28 楼 @enumerate 可以 用 testng 并行 用 xml 指定设备 有这个帖子https://testerhome.com/topics/1639
哈哈哈 好像跟楼主情况差不多 不过我们空闲更多一些,给自己提升的时间更多些,没事还是提升自己吧,这样去哪里都好
加班严重么?上次约好了面试我看了看评价就没敢去了
刚收到书了 感谢
#31 楼 @sanlengjingvv 我重新配置了一遍环境现在好了 谢谢分享的文章
@sanlengjingvv 楼主 我为什么每次执行都直接 skip 了,
用 mvn clean test 也能正常执行,所有用例都执行完了,端口也都指定了,不知道是哪里出问题了
#16 楼 @nancy2896 自己解决了 是缺少 jar 包导致的 自己网上下载了一个 guice-3.0.zip,然后倒入工程后执行成功了 生成了期待的测试报告
#16 楼 @nancy2896 用基础版的 testng.xml 没有错
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1">
<test name="test_testNG">
<classes>
<class name="testNG_test.test_testNG" />
</classes>
</test>
</suite>
现在用的 xml 如下
<?xml version="1.0" encoding="UTF-8"?>
<suite name="test" parallel="true">
<test name="test" preserver-order="true">
<classes>
<class name="testNG_test.test_testNG" />
</classes>
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter" />
<listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>
</test> <!-- Test -->
</suite> <!-- Suite -->
#12 楼 @testly
楼主你好 为什么我的每次执行完用例后要报错 浏览器能正常打开 用例能执行完毕 原来生成过报告,现在不能生成了,请指点
java.lang.NoClassDefFoundError: com/google/inject/Module
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetPublicMethods(Unknown Source)
at java.lang.Class.getMethods(Unknown Source)
at org.apache.velocity.util.introspection.ClassMap.getAccessibleMethods(ClassMap.java:258)
at org.apache.velocity.util.introspection.ClassMap.populateMethodCache(ClassMap.java:151)
at org.apache.velocity.util.introspection.ClassMap.(ClassMap.java:64)
at org.apache.velocity.util.introspection.IntrospectorBase.createClassMap(IntrospectorBase.java:126)
at org.apache.velocity.util.introspection.IntrospectorBase.getMethod(IntrospectorBase.java:112)
at org.apache.velocity.util.introspection.Introspector.getMethod(Introspector.java:100)
at org.apache.velocity.runtime.parser.node.PropertyExecutor.discover(PropertyExecutor.java:65)
at org.apache.velocity.runtime.parser.node.PropertyExecutor.(PropertyExecutor.java:39)
at org.apache.velocity.util.introspection.UberspectImpl.getPropertyGet(UberspectImpl.java:156)
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:125)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:327)
at org.apache.velocity.runtime.parser.node.ASTAddNode.value(ASTAddNode.java:66)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:51)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:95)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:449)
at org.uncommons.reportng.AbstractReporter.generateFile(AbstractReporter.java:114)
at org.uncommons.reportng.HTMLReporter.createOverview(HTMLReporter.java:143)
at org.uncommons.reportng.HTMLReporter.generateReport(HTMLReporter.java:108)
at org.testng.TestNG.generateReports(TestNG.java:1115)
at org.testng.TestNG.run(TestNG.java:1074)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.lang.ClassNotFoundException: com.google.inject.Module
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 36 more
#2 楼 @284772894 是第三方的,具体原理这些的我不是很懂,我觉得应该跟 testly 分享的文章中说到的原理是一样的,论坛里有他的文章你可以看看