Posts

Read test tag parameters in @BeforeSuite annotation method

For example your testng.xml is like   <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="Suite1" parallel="tests" time-out="72000000" preserve-order ="true" configfailurepolicy="continue">                                                             <test name="Test1" preserve-order ="true">         <parameter name="os" value="Android"/>         <parameter name="UDID_" value="41c75203"/>  </test>  <test name="Test2" preserve-order ="true">         <parameter name="os" value="IOS"/>         <parameter name="UDID_" value="abcdefghijklmnopqrstuv.."/>  </test> </suite> Now you want to read paramter names os and UDID_ in beforeSuite method for both test ta

Eclipse collapse all method definitions shortcuts and how to enable it?

To collapse all method definitions use combination ? Ctrl+Shift+Divide To expand all method definitions use combination Ctrl+Shift+Multiply How to enable disable this feature in eclipse ? RIght click on left side of console where from we show line numbers. There is an option folding> enable folding.

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.

Appium: How driver.swipe works on ios?

driver.swipe() is an appium method used to swipe on the screen. We can use this method for both Android and IOS. The general syntax of driver.swipe method is driver.swipe(int x1, int y1, int x2, int y2, int ms); (x1, y1)  The starting point of swipe (x2, y2)  The end point of swipe ms          In how much time operation should be performed in milliseconds On Android we simply pass the coordinated of starting and end point but on IOS we pass the relative point of end point. For example : We want to swipe from point (200,200) to (700,700) On Android driver.swipe(200,200,700,700,3000)     On IOS driver.swipe(200,200,500,500,3000) Another example  for IOS : We want to swipe from point (700,700) to (200,200) driver.swipe(700, 700,  -500, -500, 3000) Get screen coordinates dynamically Dimension size = driver . manage (). window (). getSize (); int startx = ( int ) ( size . width * 0.8 ); int endx = (