Xpath issue, trying to locate a element based off the results of another

  python, selenium, xpath

I am trying to use this code:

from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium import webdriver

from textblob import TextBlob


driver = webdriver.Chrome(executable_path=r'/home/littlejiver/Downloads/chromedriver_linux64/chromedriver')
wait = WebDriverWait(driver, 10)
driver.get("https://zooqle.com/movie/toy-story-l9.html?tg=7")

torrent_titles = driver.find_elements_by_xpath('//*[@id="body_container"]/div/div[1]/div[2]/div/table/tbody/tr/td[2]/a')

torrent_found_on_zooqle = False

for title in torrent_titles:
    title_to_check = TextBlob(title.text)
    if title_to_check.detect_language() == "en":
        if int(title.find_element_by_xpath('//*[@id="body_container"]/div/div/div/div/table/tbody/tr/td[5]/div/div[1]').text) == 10:
            title.click()
            torrent_found_on_zooqle = True
            break
        else:
            print("not enough seeds")

to check the red highlighted element if it passes then give me the yellow highlighted information if it qualifies

enter image description here

right now, what my code is doing is checking if the title is English and then checking the seeds but for the first row in the table and not the corresponding one.

any help you can provide would be appreciated.

Thank you!

littlejiver

Source: Python Questions

LEAVE A COMMENT