with a macro. I edit the typo step to get the word “preços de transferência” in (it doesn’t find anything w/o the non-English letters). However, the macro somehow Portugal CAAD-f78691b0-d3fb-11ed-b1b1-c7afde4192cd.json (671 Bytes)
freezes (see below). What can we do?
Hi Alex, it seems that the issue you encountered is due to the click step not finding the element with the CSS selector .hover. This situation likely occurred because the element’s state temporarily changed when it received focus, and the class hover was added to its attributes. The selector was created using this new class, but when replaying the macro, the class wasn’t present in the element being clicked, causing the selector to not match anything.
To resolve this issue, you can use the element’s id attribute instead of the .hover class for the selector. The id attribute is unique and will remain consistent, ensuring that the selector works as expected when replaying the macro. To update the selector, you can edit the macro step and replace the .hover class with the corresponding id attribute of the element. This should help to avoid the error and ensure the macro works correctly. For example, let’s say the HTML code for the clicked element looks like this:
In this case, the id attribute of the element is “example-button”. To create a CSS selector using the id, you would use the hash symbol # followed by the id value:
#example-button
@snrxtreme Any thoughts on how could this issue be handled? Should we let user re-select elements visually? When in selection mode, the temporary class could be avoided easily and users and edit the selector visually.
[ you can skip reading this paragraph if you don’t want to understand why the error occurs]
The problem is that the selector generated is buggy because of the temporary class “.hover” added to the input element when you hover over it. As soon as you move your cursor away from the input box, the hover class is removed from the input box. so “.hover” as a selector will not match any element.
Can you try the following steps to resolve?
Click on the “three dots” in the “click step” that errored out.
Please see screenshot of how the macro looks like now. However, it appears that the “wait_doc” element does not come to a stop (see the blue bar on top of it).
If “Wait_doc” is added while recording but doesn’t time-out during replay, you can delete “wait_doc” step from there and insert “wait_for_duration” step there, with the duration set to “5” seconds.
I presume you clicked on an element but it recorded drag. Can you mention which element you tried to click on ? So that i can give you a good selector .
Hi Alex, thanks for sharing the case and following up.
It looks like the click step to select an option in the dropdown in not working. The root cause is that the selector for the step to select an option in the dropdown in not able to locate the item.
I needed to manually create a selector for that element. I have exported the macro with updated selector as JSON for reference:
Following selector was used to select the second item: .select2-results__options > li:nth-child(2)
Similarly, .select2-results__options > li:nth-child(3) can be used to select the third item in the list.