- Set up for Appium:
- Reference:
- install xcode:
-
make sure you are NOT installing the latest version. Install v7 here: https://developer.apple.com/download/more/
-
make sure the correct simulators are downloaded at xcode -> preferences -> components
NOTE: If you don't have the correct simulators downloaded then you will get the error: "Could not find a device to launch..."
-
- install carthage which is an appium dependency: https://github.com/Carthage/Carthage
This file contains 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
Selenium Best Practices, | |
Use PageObjects pattern | |
Be fluent with | |
- return this, varargs, generics, | |
- reuse your model and jodatime | |
Be robust and portable | |
- Prefered selector order : id > name > css > xpath | |
- Avoid Thread.sleep prefer Wait or FluentWait | |
- Use relative URLs |
This file contains 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
import java.io.IOException; | |
import java.net.URL; | |
import java.util.Date; | |
import java.util.List; | |
import java.util.logging.Level; | |
import org.json.*; | |
import org.openqa.selenium.*; | |
import org.openqa.selenium.chrome.*; | |
import org.openqa.selenium.logging.*; |
This file contains 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
public class GridInfoExtracter{ | |
private static String[] getHostNameAndPort(String hostName, int port, | |
SessionId session) { | |
String[] hostAndPort = new String[2]; | |
String errorMsg = "Failed to acquire remote webdriver node and port info. Root cause: "; | |
try { | |
HttpHost host = new HttpHost(hostName, port); | |
DefaultHttpClient client = new DefaultHttpClient(); |
This file contains 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.test; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import org.openqa.selenium.support.events.EventFiringWebDriver; | |
import org.testng.annotations.Test; |