hope I have provided enough information here. Getting the following error (that worst of all, seems to be happening randomly, regardless of code changes):
selenium.common.exceptions.WebDriverException: Message: target frame detached
(Session info: chrome=100.0.4896.127)
Stacktrace:
Backtrace:
Ordinal0 [0x00E57413+2389011]
Ordinal0 [0x00DE9F61+1941345]
...
This is the code I have written so far:
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
PATH = r"C:\Users\Tim\Desktop\Project\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.get(WEBLINK)
search_Hours = driver.find_element(by=By.LINK_TEXT, value="Hours")
search_Hours.click()
time.sleep(3)
tech = driver.find_element(by=By.ID, value='techStudiesInnerWrap')
print(tech.get_attribute('innerHTML'))
tech_Summary = driver.find_element(by=By.ID, value='techStudiesInnerWrap').find_element(by=By.CLASS_NAME, value='summary')
print(tech_Summary.get_attribute('innerHTML'))
print(tech_Summary.text)
I suspect it has something to do with version of Chrome webdriver or perhaps the Depreciation Warning I am getting (see below). But the randomness of it has me stumped.
DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(PATH)
Chrome Browser: Version 100.0.4896.127 (Official Build) (64-bit)
ChromeDriver: ChromeDriver 100.0.4896.60
There is a slight version mismatch here, but the exact driver doesn't seem to exist for my Chrome Browser.
EDIT: If it helps anyone, I just switched to Firefox web driver. Problem solved.