devonfw-forge / mrchecker-source

Mr.Checker E2E source files
Apache License 2.0
16 stars 4 forks source link

Implemented logs and exception handling when RelativeBy is used #83

Closed lubomsky closed 8 months ago

lubomsky commented 9 months ago

Hi, I think that this implementation might be useful.

Now logs looks like this:

logDebug - Waiting for [findElementDynamic(): [unknown locator]] took [0.029 s]

and exceptions like this:

Element '[unknown locator]' was not found. Check printscreen.


Now they can look like this:

On the string extracted from the RelativeBy parameters, I used a replacement to "WebElement" when using these particular objects. Without this, the logs/exceptions could be very long and unreadable:

Element '[relative: {root={css selector=#login\-button\-niedobry}, filters=[{kind=above, args=[[[[[NewChromeDriver: chrome on windows (67107c5852f151f8513f43d4788840ac)] -> id: user-name]] -> id: user-name]]}, {kind=below, args=[[[[[NewChromeDriver: chrome on windows (67107c5852f151f8513f43d4788840ac)] -> relative: {root={css selector=#password}, filters=[{kind=below, args=[[[[[NewChromeDriver: chrome on windows (67107c5852f151f8513f43d4788840ac)] -> id: user-name]] -> id: user-name]]}]}]] -> id: user-name]]}]}]]}]}]' was not found. Check printscreen.


And here is a demo of the regex I used: regex demo

CLAassistant commented 9 months ago

CLA assistant check
All committers have signed the CLA.