0

I need to click a link from the following HTML(it is a part of HTML frame with video) with python(2.7) and library "request" in order to parse some data later. I have done some progress but I have not yet managed to display the next video. Any suggestions?

<div class="nextvideo">
    <a href="#" data-link="https://player.vimeo.com/video/133977055?title=0&;byline=0&;portrait=0"></a>

import requests
from lxml import html

session_requests = requests.session()
url = "https://www.exmple.com/"
result = session_requests.get(url)

payload = {
        "title": "0"
        "byline": "0",
        "portrait": "0",
}

result = session_requests.post(
    "https://player.example.com/video/133956055", 
    params = payload,
)
Fots
  • 11
  • 1
  • 3

1 Answers1

1

I finally found a solution to my problem using the library Selenium.

Below I quote the solution:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from lxml import html
import time


def clck(xpth):
    driver.find_element_by_xpath(xpth).click()



driver = webdriver.Chrome()
driver.get("http://www.example.com")

#username
element = driver.find_element_by_xpath('your xpath')
element.send_keys("yourusername")

#password
element2 = driver.find_element_by_xpath('your xpath')
element2.send_keys("yourpass")
time.sleep(1)

#submit
clck('your xpath')

#Menu or next video
clck('your xpath')

more information about the libraries can be found at the following links:

http://selenium-python.readthedocs.io/

http://lxml.de/

Is there a way to get the xpath in google chrome?

Community
  • 1
  • 1
Fots
  • 11
  • 1
  • 3