i have just started selenium coding. i have python 3.6.6, executing following code on jupyter notebook (with chrome broser)
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Ie("C:\\Python 36\\IEDriverServer.exe")
driver.get('https://google.com')
print(driver.title)
print(driver.page_source)
driver.close()
this is giving following output:
WebDriver WebDriverThis is the initial start page for the WebDriver server.
In this process an IE browser gets open and goes to google.com (any desired site) but not getting closed
To extract the Page Titile and the Page Source you need to:
https://www.google.com/
through get()
, i.e. including www
.quit()
instead of close()
.You can use the following solution:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Ie("C:\\Python 36\\IEDriverServer.exe")
driver.get('https://www.google.com/')
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.NAME, "q")))
print(driver.title)
print(driver.page_source)
driver.quit()