Skip to content

Instantly share code, notes, and snippets.

@Jaimin180296
Created August 19, 2021 11:07
Show Gist options
  • Save Jaimin180296/07ca777cf7c3cba761c95c8ab9cc3f69 to your computer and use it in GitHub Desktop.
Save Jaimin180296/07ca777cf7c3cba761c95c8ab9cc3f69 to your computer and use it in GitHub Desktop.
import java.net.URL;
import java.net.MalformedURLException;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
public class UseFindBy {
static IOSDriver<IOSElement> driver;
static FindBy findBy;
public static void main(String[] args) throws MalformedURLException, InterruptedException {
DesiredCapabilities caps = new DesiredCapabilities();
// Set your access credentials
caps.setCapability("browserstack.user", "<username>");
caps.setCapability("browserstack.key", "<key>");
// Set URL of the application under test
caps.setCapability("app", "bs://444bd0308813ae0dc236f8cd461c02d3afa7901d");
// Specify device and os_version for testing
caps.setCapability("device", "iPhone XS");
caps.setCapability("os_version", "12");
// Set other BrowserStack capabilities
caps.setCapability("project", "First Java Project");
caps.setCapability("build", "Java iOS");
caps.setCapability("name", "first_test");
// Initialise the remote Webdriver using BrowserStack remote URL
// and desired capabilities defined above
driver = new IOSDriver<IOSElement>(
new URL("http://hub-cloud.browserstack.com/wd/hub"), caps);
Thread.sleep(500);
findBy = new FindBy(driver);
findBy.setLogin_btn();
driver.quit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment