The click Selectors provide various methods to target and click the elements on a webpage. You can use general CSS selectors like class, ID, or tag selectors (e.g., .btn-play, #main-content), or you can use XPath selectors to target the elements on the page that requires a click. Running JavaScript on a page is also possible by using the 'javascript:' scheme.
If you need HeadlessVidX to click on multiple items or navigate through pages, you can use a comma to separate the selectors. By using comma-separated selectors can be very helpful, like when you need to interact with several elements on the page, such as navigating through different sections or pages, clicking multiple buttons, or performing a series of actions in a specific order.
Some Examples:
CSS:
play-btn
Xpath:
//*[@id='play-btn']
Javascript:
javascript:document.getElementById('play-btn').click();
Multiple Selectors:
//*[@id='watch-btn'],//*[@id='play-btn']
Use a comma to separate multiple selectors. This allows the script to follow a sequence of clicks across different elements. In the example above, the script first clicks the “Watch” button, then searches for and clicks the “Play” button.
OR (||) Selectors:
//*[@id='watch-movie']||//*[@id='watch-series']
The double vertical bar (||) tells the script to choose whichever selector is available. In this case, it will click either the “Watch Movie” button or the “Watch Series” button, depending on which one appears.
Tip: Try the free version of the SelectorsHub plugin for Chrome and Firefox. By clicking on an element, this tool will automatically generate multiple expressions for you.