正在检测WebDriverException:服务器端未知错误

问题描述 投票:0回答:1

有时Selenium / Appium远程服务器失败:(在这种情况下,测试会收到WebDriverException。具体来说,我是从SauceLabs收到的:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: Error: ESOCKETTIMEDOUT (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '87ffea49770c', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.94-73.73.amzn1.x86_64', java.version: '1.8.0_232'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {...}
Session ID: db1bcb92c9e245c1b83129b58cd726a3
*** Element info: {Using=xpath, value=(//*[contains(@cl...

我正在使用TestNG,并考虑编写一个ITestListener以仅通过请求一个新会话来处理这些问题。但是我不确定WebDriverException是否代表所有且仅服务器端故障。

有什么建议吗?

TIA,艾德里安。

P.S。这是完整的堆栈跟踪:

Session ID: db1bcb92c9e245c1b83129b58cd726a3
*** Element info: {Using=xpath, value=(//*[contains(@class,'public-chat')]/descendant::chat-message)[last()]}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
    at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
    at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:61)
    at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)
    at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:151)
    at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
    at org.openqa.selenium.By$ByXPath.findElement(By.java:353)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
    at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:57)
    at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
selenium appium saucelabs
1个回答
0
投票

[我注意到xpath是最糟糕的鸦片策略,我不会使用此xpathElement info: {Using=xpath, value=(//*[contains(@class,'public-chat')]/descendant::chat-message)[last()]}尝试为应用程序获取更短的xpath或ID,同时在元素之前添加一个webdriver等待。

© www.soinside.com 2019 - 2024. All rights reserved.