简体   繁体   中英

How to open a fully functioning chrome browser using selenium WebDriver with python?

When I'm trying to open a web page, its opening in a new chrome window stripped of all the extensions and modules. I'm not able to emulate the certain behavior of the website using selenium chrome browser window but I'm able to do the same thing in a normal chrome window without any issues.

from selenium import webdriver

driver = webdriver.Chrome(r'C:\chromedriver.exe')
driver.get("remote_worksplace_link")

id_box = driver.find_element_by_id('Enter user name')
id_box.send_keys('123456')
pass_box = driver.find_element_by_id('passwd')
pass_box.send_keys('123abc')
login_button = driver.find_element_by_id('Log_On')
login_button.click()

driver.implicitly_wait(2)

launch_button = driver.find_element_by_class_name('storeapp-icon ui-sortable-handle')
launch_button.click()

driver.implicitly_wait(5)

driver.close()

all extentions has its .crx file just you need to add those path

chrome_options = Options()
chrome_options.add_extension('path_to_extension')

driver = webdriver.Chrome(executable_path=executable_path, chrome_options=chrome_options)
driver.get("url")
driver.quit()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM