Keyword driven automation for the web
APACHE-2.0 License
Bot releases are visible (Hide)
Published by tkoukkari over 2 years ago
Changes:
Enhanced Shadow DOM support
There has been more and more cases where some (or all) elements are under shadow dom. These have been reachable via javascript only. However, it usually results hard-to-maintain test scripts like this:
GoTo chrome://settings/content/popups
${enable_popups_btn}= Set Variable document.querySelector("settings-ui").shadowRoot.querySelector("settings-main").shadowRoot.querySelector("settings-basic-page").shadowRoot.querySelector("div#basicPage").querySelector("[page-title='Privacy and security'] > settings-privacy-page").shadowRoot.querySelector("settings-animated-pages > settings-subpage > settings-category-default-radio-group").shadowRoot.querySelector("[id=radioSection] > settings-radio-group > settings-collapse-radio-button").shadowRoot.querySelector("[id=radioCollapse] > [id=button]")
ExecuteJavascript ${enable_popups_btn}.click()
...which are prone to break if the DOM structure changes at all.
We have now added enhanced Shadow DOM support for all keywords that handle textual locators (*Text), inputs (*Input) or attribute value locators (*Item). At least for now we have this under a feature flag/setting, because old test cases might potentially suddenly find more elements than before.
As an example, the above test case can be re-written in a more clear way using the new feature:
SetConfig ShadowDOM True # extends search to shadow dom elements
GoTo chrome://settings/content/popups
ClickText Sites can send pop-ups
More examples can be found for example in our tests here:
https://github.com/qentinelqi/qweb/blob/master/test/acceptance/shadow_dom.robot
Highlight color
There have been few cases where it would be useful to easily identify which of the duplicated elements QWeb finds. You can do this by changing the highlight color.
Example:
VerifyItem text anchor=2 # highlight element using default color (blue)
SetConfig HighlightColor orange
VerifyItem text anchor=Local Target in Shadow DOM
Published by tkoukkari over 2 years ago
Published by tkoukkari almost 3 years ago
[1.2.4] - 2022-01-10
AttributeError: 'NoneType' object has no attribute 'get'
on FirefoxPublished by tkoukkari almost 3 years ago
SetConfig CaseInsensitive
Published by tkoukkari almost 3 years ago
Minor bug fix release. No functional changes, only limits these dependencies:
... and documentation updates.
Selenium 4 support will be coming in later releases.
Published by tkoukkari almost 3 years ago
Published by tkoukkari about 3 years ago
Published by tkoukkari about 3 years ago
Accepting pre-fetched WebElement instance for certain keywords helps for example working with shadow doms. You can get the element using javascript (or GetWebElement if not under shadow dom) and use the returned webelement as locator to other keywords:
OpenBrowser chrome://downloads chrome
TypeText Search downloads test # This will fail as element is under shadow dom
# Get element using javascript instead and use that as a locator for TypeText
ExecuteJavascript return document.querySelector("downloads-manager").shadowRoot.querySelector("#toolbar").shadowRoot.querySelector("#toolbar").shadowRoot.querySelector("#searc
h").shadowRoot.querySelector("#searchInput"); $shadow
TypeText ${shadow} You can't write here normally!!!
You can unselect selected value(s) from multiselection dropdown using unselect=True argument:
Dropdown Canis Collie unselect=True
GetSelected returns all selected values as well, not just the latest selected value.
RunBefore can be used to run a (custom) keyword before interaction keywords (click*, get_text, dropdown). It's useful in applications where page is fully loaded but certain element like table is still fetching data and a custom spinner / load indicator is displayed.
# Robot Framework syntax, needs to be in variable
${run_bf}= SetVariable VerifyNoText Loading.... timeout=5
SetConfig RunBefore ${run_bf}
ClickText Foo
# Waits that text "Loading..." disappears before clicking text Foo
See keyword documentation for more examples.
Published by tkoukkari over 3 years ago
Published by tkoukkari over 3 years ago
Published by tkoukkari over 3 years ago
Published by tkoukkari over 3 years ago
Published by tkoukkari over 3 years ago
Added Python 3.9 support