-
카테고리
-
세부 분야
데이터 분석
-
해결 여부
미해결
NameError: name 'driver' is not defined 질문 드려요
20.09.29 07:02 작성 조회수 1.94k
0
site = "https://1.1.1.1/"
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("prefs",{
"download.default_directory":"C:\\ABCD\\temp"
})
def runTest():
driver = webdriver.Chrome(executable_path='C:/Python/project/chromedriver',chrome_options=chrome_options)
driver.get(site)
ByPassSSLAuth()
def ByPassSSLAuth(): #인증서 오류 통과
driver.find_element_by_xpath('//*[@id="details-button"]').click()
driver.find_element_by_xpath('//*[@id="proceed-link"]').click()
driver.implicitly_wait(5)
runTest()
위 코드들을 함수를 이용하지 않고 작성할 경우에는 정상적으로 작동이 됩니다.
그런데 함수에 넣어서 구동하려고 하면 NameError: name 'driver' is not defined 에러가 발생합니다.
함수를 이용해서 구현하고 싶은데 방법을 모르겠습니다.
답변을 작성해보세요.
0
답변 1