Last active
October 19, 2016 09:10
-
-
Save igorTimofiejczyk/c702046b5bbbd7805324a3f12ac4d7a7 to your computer and use it in GitHub Desktop.
BrowserName capability issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.saucelabs.appium; | |
| import io.appium.java_client.AppiumDriver; | |
| import io.appium.java_client.ios.IOSDriver; | |
| import io.appium.java_client.ios.IOSElement; | |
| import io.appium.java_client.remote.MobileCapabilityType; | |
| import java.io.File; | |
| import java.net.URL; | |
| import org.junit.After; | |
| import org.junit.Before; | |
| import org.junit.Test; | |
| import org.openqa.selenium.WebElement; | |
| import org.openqa.selenium.remote.DesiredCapabilities; | |
| public class Test { | |
| private AppiumDriver<IOSElement> driver; | |
| @Before | |
| public void setUp() throws Exception { | |
| // set up appium | |
| File appDir = new File("/Playload/"); | |
| File app = new File(appDir, "test.app"); | |
| DesiredCapabilities capabilities = new DesiredCapabilities(); | |
| capabilities.setCapability("bundleId", "com.test.app"); | |
| capabilities.setCapability("platformVersion", "10.0"); | |
| capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPad"); | |
| capabilities.setCapability("realDeviceLogger", "idevicesyslog"); | |
| capabilities.setCapability("browserName", "iPad"); | |
| capabilities.setCapability("platformName", "iOS"); | |
| capabilities.setCapability("app", app.getAbsolutePath()); | |
| URL seleniumGridIPaddress = new URL("http://10.6.87.96:4444/wd/hub"); | |
| driver = new IOSDriver<>(seleniumGridIPadress, capabilities); | |
| } | |
| @After | |
| public void after(){ | |
| driver.quit(); | |
| } | |
| @Test | |
| public void testPageSource() throws InterruptedException { | |
| WebElement email = driver.findElementByXPath("//XCUIElementTypeTextField[@name='User']"); | |
| email.sendKeys("[email protected]#10.6.87.135#4444"); | |
| System.out.println("//XCUIElementTypeTextField[@name='User']"); | |
| IOSElement nextButton = driver.findElementByXPath("//XCUIElementTypeButton[@name='Next']"); | |
| nextButton.click(); | |
| System.out.println("//XCUIElementTypeButton[@name='Next']"); | |
| Thread.sleep(1000); | |
| IOSElement password = driver.findElementByXPath("//XCUIElementTypeSecureTextField[@name='Password']"); | |
| password.sendKeys("1"); | |
| IOSElement signInButton = driver.findElementByXPath("//XCUIElementTypeButton[@name='SignIn']"); | |
| signInButton.click(); | |
| Thread.sleep(1000); | |
| IOSElement continuButton = driver.findElementByXPath("//XCUIElementTypeButton[@name='Continue']"); | |
| continuButton.click(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment