Skip to content

inessaGit/selenium_pageobject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 

Repository files navigation

Pre-requisites and setup:

  1. Maven configured and installed: http://maven.apache.org/download.cgi
  2. JDK v 1.8 installed and JAVA_HOME setup
  3. Eclipse - GIT plugin (EGIT) installed
  4. Eclipse - Maven plugin (M2Eclipse) installed
  5. Git configured and installed

----------------------------------------Pulling from git------------------------------------------------

  1. pulling project from git: http://stackoverflow.com/questions/4869815/importing-a-maven-project-into-eclipse-from-git
  • git clone https://github.com/inessaGit/selenium_pageobject.git
  • Eclipse -File -> Import... -> Existing Maven Projects OR
  • Eclipse- Window -> Show View ->"Git Repository" View -> click on "Clone from a Git Repository and add the clone to this view"
  • Eclipse -File ->Import -> "Import Maven Projects" from such clone
  1. Eclipse ->right click project name -> Build Path -> Configure Build Path -> Add External Library ->TestNG
  2. Eclipse - Project- Build path - put JDK 1.8 on your build path

----------------------------------------WebDriver compatability------------------------------------------------

SEE API: http://seleniumhq.github.io/selenium/docs/api/java/

  1. WebDriver v3.4.0 requires JDK 1.8 or higher

A.exit Firefox - Start - search - firefox.exe -p (to switch profiles) B. set Firefox 'Update' to 'Ask before updating' C. see compatability notes for FF and Selenium: https://raw.githubusercontent.com/SeleniumHQ/selenium/master/java/CHANGELOG

  1. Testing on mobile: https://seleniumhq.github.io/selenium/docs/api/java/
  • The IOSDriver extends from AppiumDriver
  • AppiumDriver extends from RemoteWebDriver This means if you want to use some specific function on IOS, it's better that select IOSDriver.

----------------------------------geckodriver v3.4.1------------------------------

BEFORE: 1. webdriver.chrome.driver for Chrome browser 2. webdriver.ie.driver for IE browser *Now we should use webdriver.gecko.driver for Firefox as well


Gecko Driver is the link between your tests in Selenium and the Firefox browser. GeckoDriver is a proxy for using W3C WebDriver-compatible clients to interact with Gecko-based browsers i.e. Mozilla Firefox . As Selenium 3 will not have any native implementation of FF => need to direct all the driver commands through Gecko Driver. Gecko Driver is an executable file that you need to have in one of the system path before starting your tests. Firefox browser implements the WebDriver protocol using an executable called GeckoDriver.exe. This executable starts a server on your system. All your tests communicate to this server to run your tests. It translates calls into the Marionette automation protocol by acting as a proxy between the local and remote ends.

Note: On Windows reading from properties file is different: silently drops backslash'' -> put double backslash '\' or replace backslash with forward slash in config.properties http://stackoverflow.com/questions/5784895/java-properties-backslash

------------------------------------------Running:-------------------------------------------------- 1)Separate test classes -> Eclipse right click class - Run as TestNG test OR 2)Test suites via command Prompt -> Change to the directory where pom.xml is located after you cloned project mvn compile mvn test OR 3) Test suites via testng.xml -> Eclipse -right click suite.xml file -> Run as TestNG suite.

--------------------------------------------Classes structure:----------------------------------

1)Each page of AUT (Application Under Test) is mapped to a class file in your code and each method within the class file can be treated as a service offered by the PageObject. see more info on Page Object pattern: https://code.google.com/p/selenium/wiki/PageObjects 2) All PageObjectTest classes should extend BaseTestSuite class (to control tests flow with @AfterSuite, @BeforeSuite etc) 3) All PageObject classes should extend BasePage class. 4) Each PageObject class and PageObjectTest class should have Logger instance (using Log4j) 5) WebDriverManager class acts as a utility class with methods to setup driver instances

About

selenium_pageobject

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages