我正在尝试在具有chrome版本:76.0.3809.89的Android手机上启动chrome
运行Java程序时,出现以下错误:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Unable to automate Chrome version because it is too old for this version of Chromedriver.
Chrome version on the device: Chrome/76.0.3809.89
Visit 'https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md' to troubleshoot the problem.
Failed to start Chromedriver session: A new session could not be created. Details: session not created: Chrome version must be between 71 and 75
**(Driver info: chromedriver=2.46.628402** (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17763 x86_64)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'abc', ip: '10.0.1.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221'
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to automate Chrome version because it is too old for this version of Chromedriver.
**Chrome version on the device: Chrome/76.0.3809.89**
Visit 'https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md' to troubleshoot the problem.
我有以下问题:
chromedriver=2.46.628402
进行选择?我的代码:
package browserTest;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class ChromeTest {
public static void main(String args[]) {
//Set the Desired Capabilities
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("deviceName", "My Android Mobile");
cap.setCapability("udid", "521010f9ee4fb499");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "7.0");
cap.setCapability("browserName", "Chrome");
cap.setCapability("noReset", true);
//Instantiate Appium Driver
AppiumDriver<MobileElement> driver = null;
try {
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), cap);
}catch (MalformedURLException e) {
e.getMessage();
}
//Open URL in Chrome browser
driver.get("http://www.google.com");
}
}
答案 0 :(得分:1)
我将Windows和AppiumServer与nodejs一起使用
您可以从https://chromedriver.storage.googleapis.com/index.html下载 匹配的Chrome驱动程序版本
并在以下位置更改chrome驱动程序
C:\ Users \ {用户名} \ AppData \ Roaming \ npm \ node_modules \ appium \ node_modules \ appium-chromedriver \ chromedriver \ win
使用此命令 chromedriver.exe -version
您可以检查这样的版本
C:\ Users \ {用户名} \ AppData \ Roaming \ npm \ node_modules \ appium \ node_modules \ appiu m-chromedriver \ chromedriver \ win> chromedriver.exe -version
ChromeDriver 2.46.628402(536cd7adbad73a3783fdc2cab92ab2ba7ec361e1)
C:\ Users \ {用户名} \ AppData \ Roaming \ npm \ node_modules \ appium \ node_modules \ appiu m-chromedriver \ chromedriver \ win> chromedriver.exe -version
ChromeDriver 76.0.3809.12(220b19a666554bdcac56dff9ffd44c300842c933-refs / branch- heads / 3809 @ {#83})
答案 1 :(得分:0)
您需要可以处理设备上的Chrome 76的正确chromedriver。
您可以尝试使用appium手动设置,请参见here:
npm install appium --chromedriver_version =“ 76.0.3809.68”
另一个可行的选择是使用WebDriverManager。 它会自动下载正确的驱动程序并相应地设置功能。 只需将其添加到您的项目中即可。
例如,如果您有gradle项目,则将以下行添加到build.gradle:
编译组:“ io.github.bonigarcia”,名称:“ webdrivermanager”, 版本:“ 3.6.2” 然后,您需要在驱动程序功能中设置chromedriver:
WebDriverManager.chromedriver().setup();
cap.setCapability("chromedriverExecutable", WebDriverManager.chromedriver().getBinaryPath());