0

Anyone have any advice for locating elements on python anywhere using xvfb-run ? I get the driver up and display using the following code but when I try and locate an element by path I get cannot find element. This code works fine on my local machine. The driver does successfully navigate to lmcu.org when I print the url of the browser.

from pyvirtualdisplay import Display
from selenium import webdriver
display = Display(visible=0,size=(800,600))
display.start()
browser = webdriver.Firefox()
browser.get("http://www.lmcu.org")
usr = browser.find_element_by_xpath(".//*[@id='LoginName']")

1 Answer 1

1

A useful debugging tool is to print the body text of the page you're looking at so you can verify that you're getting the page that you expect.

Sign up to request clarification or add additional context in comments.

1 Comment

answer found….Pythonanywhere only allows you to access the elements from their whitelist* websites. Need to upgrade my account. Thanks.

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.