Open ayushi-nyk opened 1 year ago
Please follow migration guides, for Appium you can find the guide here: https://github.com/appium/java-client/blob/master/docs/v7-to-v8-migration-guide.md
@valfirst The error I got is before driver invocation , below is my code and pom.xml-
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
Code -
package testverifypackage;
import java.net.URL; import java.util.HashMap;
import io.appium.java_client.AppiumDriver; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.options.UiAutomator2Options; import io.appium.java_client.remote.options.BaseOptions;
public class AppiumUpgrade {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
UiAutomator2Options options = new UiAutomator2Options().setPlatformName("Android");
options.setCapability("appium:platformVersion", "11.0");
options.setCapability("appium:deviceName", "Samsung Galaxy S21 Ultr");
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("user","***");
browserstackOptions.put("key","***");
browserstackOptions.put("appiumVersion", "2.0.0");
options.setCapability("bstack:options", browserstackOptions);
System.out.println("options == " +options);
AndroidDriver driver = new AndroidDriver(
new URL("http://hub.browserstack.com/wd/hub"), options);
System.out.println("Appium Driver is Up !!!");
driver.quit();
System.out.println("Appium Driver is Closed !!!");
}
catch(Exception e) {
System.out.println("Exception e === " + e);
}
}
}
Error - Exception e === org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Unable to parse remote response: Authorization required
@ayushi-nyk most likely you provided wrong credentials, or used improper way to provide credentials
@valfirst The same is working fine when i used selenium 3.1 and appium 7.6 . Is this something related to appium and selenium version compatibility .
@ayushi-nyk Appium Java Client follows semantic versioning, it means bump of major version may introduce breaking changes
@ayushi-nyk I was with the same issue in a recent project, but I am actually studying about the new versions of Appium and Selenium, and I am really focused in this project, and I found your issue, but yet without a fix. Please for this new format using new Selenium and Appium, try this values:
Replace: user to userName key to accessKey
if (platform.equals("DEVICE_FARM")) {
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("app", "bs://??????");
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("userName", userName);
browserstackOptions.put("accessKey", accessKey);
browserstackOptions.put("osVersion", "13.0");
browserstackOptions.put("deviceName", "Google Pixel 7");
browserstackOptions.put("projectName", "Project Name");
browserstackOptions.put("buildName", "1.0");
browserstackOptions.put("sessionName", "Session Name");
browserstackOptions.put("appiumVersion", "2.0.0");
browserstackOptions.put("local", "false");
browserstackOptions.put("debug", "true");
browserstackOptions.put("timezone", "New_York");
capabilities.setCapability("bstack:options", browserstackOptions);
androidDriver = new AndroidDriver
(new URL("http://hub.browserstack.com/wd/hub"), capabilities);
androidDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(SHORT_TIMEOUT));
waitDriver = new WebDriverWait(androidDriver, Duration.ofSeconds(LONG_TIMEOUT));
}
@ayushi-nyk I was with the same issue in a recent project, but I am actually studying about the new versions of Appium and Selenium, and I am really focused in this project, and I found your issue, but yet without a fix. Please for this new format using new Selenium and Appium, try this values:
Replace: user to userName key to accessKey
if (platform.equals("DEVICE_FARM")) { MutableCapabilities capabilities = new MutableCapabilities(); capabilities.setCapability("app", "bs://??????"); HashMap<String, Object> browserstackOptions = new HashMap<String, Object>(); browserstackOptions.put("userName", userName); browserstackOptions.put("accessKey", accessKey); browserstackOptions.put("osVersion", "13.0"); browserstackOptions.put("deviceName", "Google Pixel 7"); browserstackOptions.put("projectName", "Project Name"); browserstackOptions.put("buildName", "1.0"); browserstackOptions.put("sessionName", "Session Name"); browserstackOptions.put("appiumVersion", "2.0.0"); browserstackOptions.put("local", "false"); browserstackOptions.put("debug", "true"); browserstackOptions.put("timezone", "New_York"); capabilities.setCapability("bstack:options", browserstackOptions); androidDriver = new AndroidDriver (new URL("http://hub.browserstack.com/wd/hub"), capabilities); androidDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(SHORT_TIMEOUT)); waitDriver = new WebDriverWait(androidDriver, Duration.ofSeconds(LONG_TIMEOUT)); }
Hi @Liandro73, how can i put more devices? I hope u can help me
Hi @Salchi12, you can use a browserstack.yml file to send parallel tests:
userName: yourUser
accessKey: yourPass
framework: testng
app: bs://sample.app
platforms:
- platformName: android
deviceName: Samsung Galaxy S22 Ultra
platformVersion: 12.0
- platformName: android
deviceName: Google Pixel 7 Pro
platformVersion: 13.0
- platformName: android
deviceName: OnePlus 9
platformVersion: 11.0
browserstackLocal: true
buildName: 0.1.0
projectName: Project Name
@Liandro73 but when i use the yml file and the execution throws me test with diferent devices I choose
@Salchi12 You know that BrowserStack has a list of possible devices to choose from, right? Try this link to verify the devices and OS version, before to set your test execution: https://www.browserstack.com/automate/capabilities?tag=selenium-4
I have below selenium version 4 and io.appium version 8 java client dependency in same pom.xml -
,
When I able to run app test on browser stack then getting below error - Exception e === org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Unable to parse remote response: Authorization required
However this issue was not happening when I was using selenium 3.1 and appium 7.6 .
All I want is to upgrade the selenium version 4 in my framework and we have common framework for web and app.
Please suggest.