Posts

Showing posts from March, 2017

Appium: How to turn off wifi on android and ios device ?

Turn off Wifi  For Android  NetworkConnectionSetting con=new NetworkConnectionSetting(false, true, false); con.setWifi(false); ((AndroidDriver<WebElement>)automationDriver.appiumDriver).setNetworkConnection(con); For Ios int height = appiumDriver.findElementByClassName("XCUIElementTypeWindow").getSize().getHeight(); int width = appiumDriver.findElementByClassName("XCUIElementTypeWindow").getSize().getWidth(); appiumDriver.swipe(width/2, height-3, 0, -200, 50); Thread.sleep(1000); appiumDriver.findElementByAccessibilityId("Wi-Fi").click(); Thread.sleep(1500); int tap_startX= (int) 341.2; int tap_startY = (int)451.3; int tap_finger= 1; int tap_duration=2; appiumDriver.tap(tap_finger, 100 , 100 , tap_duration ); Thread.sleep(2000); Turn on Wifi  For Android  NetworkConnectionSetting con=new NetworkConnectionSetting(false, true, false); con.setWifi(true); ((AndroidDriver...

Selenium: Execute selenium scripts on Chrome browser ?

You have to create system property before creating chromedriver object System . setProperty ( "web driver.chrome.driver" , "C:\\Users\\Desktop\\chromedriver_win32\\chromedriver.exe" ); WebDriver driver=new ChromeDriver(); It should be lower case  webdriver.chrome.driver System . setProperty ( "webdriver.chrome.driver" , "C:\\Users\\Desktop\\chromedriver_win32\\chromedriver.exe" ); instead of System . setProperty ( "WebDriver.Chrome.Driver" , "C:\\Users\\Desktop\\chromedriver_win3 2\\chromedriver.exe" ); Need to be careful with the lower or upper case. 

Appium : How to press Home button of IOS device to send app in background ?

On Ios device we can't press home button of device but we can use appium library method to send app in background : driver.runAppInBackground(seconds); It will send app in background for given time in seconds.