1

This is HTML code of that page

From there I want to access the 2nd element by using class name "maxbutton-1" as it has 3 same buttons and I can't use xpath or any constant selector so want to use the indexing with class and can't find anything to do that in python particular.

Also tried the method used in java to do same thing but it didn't worked.

Link of that same page

just trying to automate the movie downloading process for any movie.

Thank you.

2
  • 1
    Show your code trials and errors. Do not add the screenshot of the code that can be simply pasted as code. which will be easy to debug the things. Commented Apr 7, 2021 at 16:11
  • so, what is your question?find element or help you download links?or download movies automatically? Commented Apr 7, 2021 at 16:14

1 Answer 1

1

To click on first, second or third button, try to change number of element:

el1 = driver.find_element_by_xpath("(//a[@class='maxbutton-1 maxbutton maxbutton-download-links'])[1]")

el2 = driver.find_element_by_xpath("(//a[@class='maxbutton-1 maxbutton maxbutton-download-links'])[2]")

el3 = driver.find_element_by_xpath("(//a[@class='maxbutton-1 maxbutton maxbutton-download-links'])[3]")

then you can extract element href/link attribute like that:

link = el.get_attribute('href')

or click it like that:

el.click()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.