This seems like it should be pretty straightforward, but I am not seeing how to get access to values in my GebConfig.groovy file. I've tried the following:
userName = "myUserName"
properties = {
userName = "myUserName"
}
props {
userName = "myUserName"
}
environments {
chrome = {
driver = { new ChromeDriver() }
userName = "myUserName" //with and without {}
}
}
Yet I still can't seem to access these properties through:
browser.driver.properties.userName
Am I able to set those properties in the configuration file, and then access them in my spec? I seem to be getting the default set of properties, which is simply the System properties.
Geb is a Web automation framework using Groovy. Geb uses WebDriver to test web applications using either real browsers or the HtmlUnit library.
Geb is a browser automation solution. It can be used for scripting, scraping and general automation — or equally as a functional/web/acceptance testing solution via integration with testing frameworks such as Spock or JUnit. Spock. Spock is a testing and specification framework for Java and Groovy applications.
Geb is a free, open-sourced tool. It is licensed under the Apache License, Version 2.0. Easy and simple to automate web testing. Geb's Page Objects and Groovy DSL make tests readable to the extent that they almost look like plain English. Runs the tests fast and thus saves the time and cost of testing.
This was rather quite simple, however I was making the problem much harder than it should have been. I couldn't see the forest for the trees.
I noticed that in the Configuration class, items from the rawConfig were being grabbed from the readValue method(s). The getRawConfig was also not showing up in the outline or in the configuration sources, leading me to skip right over attempting to access it directly.
browser.getConfig().getRawConfig().get("userName")
Or in a more groovy like fashion:
browser.config.rawConfig.userName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With