Selenium---Python3--获取网页url/获取网页title
#coding = utf-8 from selenium import webdriver #引入Keys类 from selenium.webdriver.common.keys import Keys import time #D:\chromedriver_win32\chromedriver.exe class driver_1(object): #定义一个对象 def __init__(self): self.driver = webdriver.Chrome('D:\chromedriver_win32\chromedriver.exe') def driver_1_1(self): self.driver.get('https://www.baidu.com/') #查看网页title print(self.driver.title) #查看网页URL print(self.driver.current_url) if __name__ == "__main__": a = driver_1() a.driver_1_1()