If the element is currently visible, such as the following:
I only need to execute page.get_by_text("target_string").click()
to complete the click.
However, if an element is currently invisible:
directly using page.get_by_text("target_string").click()
will report an error, and you need to slide down to display the element and make it clickable.
There are two solutions. One is to press and hold the scroll bar with the mouse and drag it until it is visible. The other is to move the mouse to the entire selection window and then scroll the wheel to make the target element visible directly.
Is there a method in Playwright that automatically helps me drag the scroll bar when the element I am looking for is not visible?
li ki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2