How do I add the ChromeDriver to the code below?
//Check the Contexts
Set contextHandles = androiddriver.getContextHandles();
//Switch to the New Context
String chromeContext = null;
for (String contextHandle : contextHandles) {
if (contextHandle.startsWith("WEBVIEW_")) {
chromeContext = contextHandle;
break;
}
}
try
{
//Switch to Chrome Context
if (chromeContext != null) {
androiddriver.context(chromeContext); // Encountered internal error running command: Error: No Chromedriver found that can automate Chrome '114.0.5735'
} else {
System.out.println("Chrome context not found.");
}
}
catch (Exception e)
{
System.out.println(e);
}
I Tried this.
DesiredCapabilities capabilities = new DesiredCapabilities();
ChromeOptions chromeOptions = new ChromeOptions();
// Add other Chrome options and desired capabilities
chromeOptions.setPageLoadStrategy(PageLoadStrategy.NORMAL);
//chromeOptions.setCapability(“appium:chromedriverAutodownload”, true);
chromeOptions.setBinary(“Path to ChromeDriver”);
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
AndroidDriver androiddriver2 = null;
// Initialize the AndroidDriver with desired capabilities
try
{
androiddriver2 = new AndroidDriver(new URL(“http://127.0.0.1:4723”), capabilities);
}
catch (Exception e)
{
System.out.println(“MIH”);
}
I’m getting there error: Response code 404. Message: Unable to find handler for (POST) /session
Solved.
I was able to resolve my issue by add the path to the chromedriver when I initialized the original Android Driver.
capabilities.setCapability(“chromedriverExecutable”, “Path to the version of chromedriver on the device”);