FAQ
Here you can find the most frequently asked questions regarding working with MrChecker and installation problems.
Common problems
I can’t find the boilerplate module. Has it been removed?
The boilerplate module has been removed from the GitHub project on purpose.
There were problems with naming and communication, not everybody was aware of the meaning of the word boilerplate.
The name of the folder has been changed to template. It can be found in the GitHub project.
Is it possible to use Docker with MrChecker?
MrChecker works seamlessly with Docker.
A direct example of how to use it can be found in following JenkinsFile https://github.com/devonfw/devonfw-testing/blob/develop/mrchecker-app-under-test/pipelines/CI/Jenkinsfile_node.groovy
Note that the structure of the folders can be changed. If that happens - search in repo for /pipeline/CI/Jenkinsfile_node.groovy
Tests are not stable
Selenium tests perform actions much faster than a normal user would. Because pages can contain dynamically changing content, some web elements can still not be loaded when Selenium driver tries to access them.
getDriver().waitForPageLoaded()
method checks ready state in the browser, that’s why stability problems may happen in advanced frontend projects.
To improve test stability you can:
-
add waiting methods before dynamically loading elements e.g.
getDriver().waitForElement(By selector)
-
add timeout parameter in
method getDriver().findElementDynamic(By selector, int timeOut)
-
change global waiting timeout value using method
getDriver().manage().timeouts().implicitlyWait(long time, TimeUnit unit)
Furthermore, if the page displays visible loading bars or spinners, create FluentWait method to wait until they disappear.
Notice that by increasing timeouts you may improve stability but too long waiting time makes tests run slower.
Learn more from tutorials:
Example 10: Dynamically loaded Elements
Example 11: Exit intent
Example 12: File download test
How to
How to: Change timeouts?
If you would like to change timeouts - you don’t have to change them globally. It is possible to add waiting time parameter to searching methods, such as:
getDriver().findElementDynamic(By selector, int timeOut)
timeout - in seconds
It is recommended to use methods that significantly level up the repetitiveness of the code:
getDriver().waitForElement(By selector); getDriver().waitForElementVisible(By selector); getDriver().waitForPageLoaded(); getDriver().waitUntilElementIsClickable(By selector);
Or Fluent Wait methods with changed timeout and interval:
FluentWait<WebDriver> wait = new FluentWait<WebDriver>(getDriver()) .withTimeout(long duration, TimeUnit unit) .pollingEvery(long duration, TimeUnit unit); wait.until((WebDriver wd) -> expectedCondition.isTrue()); getWebDriverWait().withTimeout(millis, TimeUnit.MILLISECONDS) .withTimeout(long duration, TimeUnit unit) .pollingEvery(long duration, TimeUnit unit) .until((WebDriver wd) -> expectedCondition.isTrue());
These methods allow You to change WebDriver timeouts values such as:
getDriver().manage().timeouts().pageLoadTimeout(long time, TimeUnit unit)
the amount of time to wait for a page to load before throwing an exception. This is the default timeout for method getDriver().waitForPageLoaded()
getDriver().manage().timeouts().setScriptTimeout(long time, TimeUnit unit)
the amount of time to wait for execution of script to finish before throwing an exception
getDriver().manage().timeouts().implicitlyWait(long time, TimeUnit unit)
the amount of time the driver should wait when searching for an element if it is not immediately present. After that time, it throws an exception. This the default timeout for methods such as getDriver().findElementDynamic(By selector)
or getDriver().waitForElement(By selector)
Changing timeouts can improve test stability but can also make test run time longer.
How to: Start a browser in Incognito/Private mode?
In MrChecker there is a fpossibility of changing browser options during runtime execution.
To run the browser in incognito mode:
-
In Eclipse - open Run Configurations window:
-
Select a test which you want to run and switch to arguments tab:
-
Add VM argument:
-
for the incognito mode in chrome:
-
Read more about browsers' options: https://github.com/devonfw/devonfw-testing/wiki/Run-with-different-browser-options
Installation problems
Chromedriver version is not compatible with Chrome browser
Problem:
During the tests your web browser window opens and immediately closes, all your tests are broken.
Following error message is visible in the test description:
session not created: This version of ChromeDriver only supports Chrome version 76 Build info: version: '<build_version>', revision: '<build_revision>', time: '<time>' System info: host: '<your_computer_name>', ip: '<your_ip_address>', os.name: '<your_os_name>', os.arch: '<your_os_architecture>', os.version: '<your_os_version>', java.version: '<java_version_installed>' Driver info: driver.version: NewChromeDriver
Solution:
-
Make a change in the following files:
-
MrChecker_Test_Framework\workspace\devonfw-testing\src\resources\settings.properties
-
For project template-app-under-test:
MrChecker_Test_Framework\workspace\devonfw-testing\template\src\resources\settings.properties
-
For project example-app-under-test:
MrChecker_Test_Framework\workspace\devonfw-testing\example\src\resources\settings.properties
Change the value of
selenium.driverAutoUpdate
field formtrue
tofalse
-
-
Replace the following file with a version compatible with your browser:
MrChecker_Test_Framework\workspace\devonfw-testing\example\lib\webdrivers\chrome\chromedriver.exe
.
My browser opens up in German by default
Problem:
I would like my browser to use the English language, but the default language for the browser is German. How can I change the settings?
Solution:
There is a Properties file installed together with MrCheker installation. It is possible to set the language in which a browser could be opened for testing purposes in Properties > Selenium configuration,.