RustyShackleford RustyShackleford - 3 years ago 81
Python Question

How to automate the "next" or "previous" button clicking on webpage after end of video?

I want to automate the clicking of the "next" or "previous" button on this website.

The "next" and "previous" buttons however are not labeled this way on any of the links. Instead the buttons titles are the cartoon name and episode number. the increasing episode number means "next" and decreasing numbers mean "previous episode". Example here:

My question is how could I mimicking this solution(python clicking a button on a webpage) using selenium or something similar allow the application to wait till the video is done playing and then to go on to the next episode?

The main objective if it helps, is to allow the user to pick a cartoon series and let them either pick 'UP' or 'DOWN' from any point in the series to have the series go up in episodes or down in episodes.

hope the question makes sense.

thank you in advance.

Answer Source

To answer the "locating the links problem", you can locate the "previous" and "next" links this way:

previous, next = driver.find_elements_by_css_selector("#elinks > a")

As far as waiting for the videos to finish - I'm not sure, these are flash player videos and not HTML5 videos which would be much easier to interact with.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download