Sometimes the action you want to perform isn’t available via Selenified. Luckily this doesn’t mean you need to abandon Selenified.
If you need to perform the custom action, use the
app object to retrieve the driver.
WebDriver driver = app.getDriver();
Then perform the action that you need to. This is the standard Selenium
WebDriver so you can do anything you’d normally do with Selenium. Of course, there are a few downsides but you also get additional upsides from Selenified. There is no error handling and no custom reporting. Luckily, you can also write your own reporting features for these custom actions. To do this, retrieve the
OutputFile object from the
app object, and call the
recordAction method on.
OutputFile file = app.getOutputFile(); file.recordAction(action, expectedResult, actualResult, result);
Sometimes, even this isn’t enough. Despite all of the checks that come with Selenified, sometimes you just want to look for something else. You can use
recordActualto do just this. These two method record what you’re looking for, and then what actually happened, respectively. Because they are a part of the Selenified framework,
recordActual makes use of the inner workings and will still grab that nice screenshot for you, whether you pass it or fail it.
OutputFile file = app.getOutputFile(); file.recordExpected(expectedOutcome); file.recordActual(actualOutcome, result);
Of course, if this is something that you believe others can benefit from, feel free to open an issue. We’re actively working on development, and are willing and able to fix it. You can also fork the repository, make some fixes or changes yourself, and submit a Pull Request. We are happy to have an active and interested community!
To get your code updates accepted, follow the below process:
- Fork the Selenified github repo
- Navigate to https://github.com/Coveros/selenified
- Click fork in the upper right corner
- Select your user
- Clone your new repository locally
- And that’s it, you’ve forked the codebase
- Determine if adding an action or assert
- Determine what that action/assert is acting on
- The App
- The Element
- Determine if that action is acting directly, or gathering information about the page (get, is, wait)
- In the appropriate class, add your action as a method
- Write integration tests
- Be sure to include both positive and negative tests
- Full branch coverage is expected
- Finally, submit a pull request for your fork
- Navigate back to https://github.com/Coveros/selenified
- To the right of the Branch menu, click New pull request
- On the Compare page, click compare across forks
- Confirm that the base fork is the repository you’d like to merge changes into. Use the base branch drop-down menu to select the branch of the upstream repository you’d like to merge changes into
- Use the head fork drop-down menu to select your fork, then use the compare branch drop-down menu to select the branch you made your changes in
- Type a title and description for your pull request
- Click Create pull request.