Browser Commands
Context:
The Browser commands are generally the ones which we intuitively feel that a browser should control. Examples are “type url and hit enter”, “getTitle”,”back”,”forward” and so on. Video of the execution and walk through code is explained in the video at the bottom of this page.
Pre-Requisites
- Install Java JDK
- Install Maven
- Install and Configure Eclipse OR Install IntelliJ Community Edition
- Set up selenium webdriver components
It is assumed that you have downloaded the Class1 code base. – https://github.com/machzqcq/CucumberJVMExamples
Agenda:
- Simple cucumber scenario adding two numbers
- Selenium Scenario
- Browser Title, Current url, page sources
- Browser forward, backward and refresh
1. Navigate to url (Go to a URL)
2. Browser Title
4. Browser back
5. Browser forward
6. Browser refresh
7. Browser current url
Steps
- Once you have downloaded the codebase, import it into your Eclipse IDE by File – Import – Maven – Existing Maven Projects. Note:Eclipse Luna has maven plugin by default
- Point to the root folder of “cucumber-java-selenium-class1” [Basically the folder that contains the pom.xml for class1]
- There are two cucumber scenarios “addition.feature” and “BrowserCommands.feature”
- Right click anywhere on the feature file and Run As – Cucumber Feature. Again this is explained on Cucumber First project
After importing the project into eclipse, it should look like this
After importing the project into Intellij, it should look like this
Standards
- Unless otherwise specified, our training class projects will have the files src/test/java/step_definitions/Hooks.java [We explained this file in Cucumber first project]
- Unless otherwise specified, our training classe projects will have file src/test/java/step_definitions/RunCukesTest.java [We explained this file in Cucumber first project]
- Rest of the files will be specific to the functionality we explain on each page.