I am having an issue where after calling get(), the code sometimes works, other times it doesn't. No search results have this issue. Why would it work sometimes, other times it won't. Simple code to reproduce:
def get_url(search):
options = Options()
options.add_argument('-headless')
driver = webdriver.Firefox()
driver.get('https://genius.com/')
print('go')
elem = driver.find_element(By.ID, 'application')
print(elem)
driver.quit()
I've been troubleshooting for hours, so it's an excerpt at it's simplest, with some debugging. It could work twice in a row, then not work twice or three times. Rinse and repeat. Any ideas?
EDIT:
Also, I have tried WebDriverWait as well. Same thing happens. Sometimes it succeeds, other times it doesn't. When it doesn't succeed, it seems to get stuck at get(). After 1 or 2 mins, it errors out and the script closes. Odd.
