我正在尝试使用Appium + Protractor在我的混合应用程序上运行一个简单的测试,因为我收到了以下错误:无法获得套接字匹配:@webview_devtools_remote _。* 15239
我正在使用Ubuntu,并且我已经设置了Appium和Protractor,尝试了我在互联网上找到的每一个解决方案都无法解决问题。
只有“删除”错误的是将以下代码添加到功能中:
chromeOptions: {
androidPackage: "com.android.chrome"
},
但后来我只进入应用程序,而Appium服务器只是陷入困境:
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8001/wd/hub/session] with body: {"desiredCapabilities":{"chromeOption {"androidPackage":"com.android.chrome","androidUseRunningApp":true,"androidDeviceSerial":"1cdc4ed10c027ece"}}}
它根本不会启动spec文件。
var SpecReporter = require('jasmine-spec-reporter')。SpecReporter;
exports.config = {seleniumAddress:'http://localhost:4723/wd/hub',allScriptsTimeout:50976,
specs: [
'test.js'
],
capabilities: {
platformName: 'Android',
platformVersion: '8.0.0',
deviceName: 'Galaxy S9',
app: 'path_to_app',
autoWebview: true,
browserName: '',
appPackage: 'app_package_name',
newCommandTimeout: '140',
chromeOptions: {
androidPackage: "com.android.chrome"
}
},
onPrepare: function () {
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
},
framework: 'jasmine',
jasmineNodeOpts: {
print: function () {}, //remove protractor dot reporter
defaultTimeoutInterval: 100000
}
}
这似乎是一个常见的问题。来自github的问题:https://github.com/appium/python-client/issues/255
如果您想要在移动电话上切换到Web浏览器,而您已经在移动应用程序上安装了appium,也会发生这种情况。
为避免出现此异常,如https://github.com/appium/appium/issues/11189中所述,[Chromedriver]错误:无法启动Chromedriver会话:处理命令时发生未知的服务器端错误。 (原始错误:未知错误:无法获得套接字匹配:@webview_devtools_remote _。* 24811,
在尝试切换到手机上的网络浏览器之前,请将appium强行重新安装到网络,如下所示。 Appium将试用该应用程序然后被强制切换到网络浏览器而不再抱怨:
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome"); // or other browsers
desiredCapabilities.setCapability("noReset", true );
try
{
URL url = new URL("http://127.0.0.1:4723/wd/hub");
AppiumDriver driver = new AppiumDriver(url, desiredCapabilities);
}
catch (Exception e )
{
}