Forums

Selenium Finds CSS Selector on Desktop but not PA

Hey All, hoping someone can help out!

I have a Flask + Selenium app that "runs" on PA. The issue i'm having is as follows:

If I run the app on my desktop, it succesfully follows the chain of events: * Logs into LinkedIn * Views a page * Scrapes the page for a CSS Selector

However, that last step, scraping for the css selector, just doesn't work on PA and i'm wondering if anyone might have a inkling why. Here's the code i'm using:

driver.get("{}".format(person_account))
elementID = driver.find_element(By.ID, 'username')
elementID.send_keys(email)

elementID = driver.find_element(By.ID, 'password')
elementID.send_keys(kittykats)
elementID.submit()

# get posts
try:
    WebDriverWait(driver, 120).until(lambda x: x.find_element(By.CSS_SELECTOR, ".update-components-text"))
finally:
    element = driver.find_element(By.CSS_SELECTOR, '.update-components-text')
    video = driver.find_element(By.CSS_SELECTOR, '.vjs-tech').get_attribute('src')
    print('video is: ' + video)
    print(element.text)

    data = {
        "text": element.text,
        "video_link": video
    }
    driver.quit()
    print(data)
    return data

Hoping someone can point me in the right direction! :) Thank you!

Check the content of the page that you're getting back to see why the element that you're looking for is not there.