I’ve added a console.log to the extension and saw that the JS is being executed.
I do see the error:
“Uncaught (in promise) {message: “The message port closed before a response was received.”}”
but I’m not sure if that is the cause of the issue. I’m pretty sure the JS is executed but the return is not being used, any idea as to how to resolve this?
The storeTextLength command is provided by the extension script, therefore it will not appear in the list of suggested commands. It has to be typed manually:
Thanks for the info, now it works as expected.
Just to clarify is there a test that is run on the returned value before it is added? a test that verify that the string can actually return a valid selenium element. If so can it be disabled?
I see that if I return a simple string “nope” it is not being registered.
I recorded a session in a site that support multiple languages (session was recorded in English). Then I tried to reply it again on the same site with a different language. The test failed as the recorder used xpath + text, for example:
" driver.find_element_by_xpath("(.//*[normalize-space(text()) and normalize-space(.)=‘lolz245’])[1]/following::div[5]").click()"
The recorded session will fail on any other language beside English.
So I have a script that tries to find multiple uniqueness of a selected element. So I was hoping to use the extension script in such a way: When an element is being interacted with I run my JS script on that element, then I register in the recorder the output of that script (false/array of matches).
Then I use the exported code to re run the steps on each language.
Is there any other locator type that suits your need? If there is, you can change the preferred order so that the above XPath will not be the first suggestion.