I've just updated selenium in my django app on PythonAnywhere. This is my code:
from selenium import webdriver
def Synonym():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)
browser.get("https://www.synonym.com/synonyms/test")
test = browser.find_element_by_class_name("logo").text
browser.quit()
return test
But it gives me an error:
AttributeError: 'dict' object has no attribute 'text'
When I grab it without the .text this is what it gives me:
{'ELEMENT': '0.3567871003333163-1'}
I'm using a paid account and should be able to access any site. Sidenote: is there a way to stop selenium from making /tmp/ files and folders?
Thanks!
CodePudding user response:
The fix for me on PythonAnywhere was to update the system image: https://help.pythonanywhere.com/pages/ChangingSystemImage
Answer courtesy of caseneuve!