3

I need to click on div with pseudo element ::after.

Div itself is invisible, but after hovering on another element, the div::after append icon at the end of div which I need to click.

How can I create a selector for div::after?

I can perform click in console with jQuery, but I can't do it in testcafe, because I get

Error:'actionElementIsInvisibleError'.

Use selector .more-options::after is not working

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
valen-tina
  • 61
  • 3

2 Answers2

3

You have to simulate yourself the hovering effect by 'patching' the style of the targeted div. In other words you have to make it visible by calling a client function that will change the div style. You may find a code sample here : tc-client-function-set-style-attribute

hdorgeval
  • 3,000
  • 8
  • 17
0

I had similar challenge with checkboxes

One of the thing I did is to setting the visibility of the element before clicking it.

ex:

const consent = ClientFunction(() => {
  document.getElementById("agb").style.visibility = "visible";
  document.getElementById("datasecurity").style.visibility = "visible";
});

then call the function and then click on the checkboxes.

Manoj Kengudelu
  • 647
  • 1
  • 8
  • 21