im tryng to load my default chrome profile but instead of opening my profile it open a new istance of chrome
from selenium import webdriver
#object of ChromeOptions class
o = webdriver.ChromeOptions()
#adding Chrome Profile Path
o.add_argument = {'user-data-dir':r'C:\Users\liamm\AppData\Local\Google\Chrome\User Data\Default'}
#set chromedriver.exe path
driver = webdriver.Chrome(executable_path=r"C:\Users\liamm\Desktop\selenium\driver\chromedriver.exe", options=o)
#maximize browser
driver.maximize_window()
#launch URL
driver.get("https://www.tutorialspoint.com/index.htm")
Related
from selenium import webdriver`
import time
from selenium.webdriver.chrome.options import Options
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Users\\avayn\\AppData\\Local\\Google\\Chrome\\User Data\\Default")
driver = webdriver.Chrome(executable_path=r'E:\chromedriver_win32\chromedriver.exe', chrome_options=options)
#options.add_argument("--disable-extensions")
driver.get("https://www.ea.com/tr-tr/fifa/ultimate-team/web-app/")
time.sleep(15)
transfer = browser.find_element_by_xpath("/html/body/main/section/nav/button[3]").click
Normally, I can login automatically, but my chrome profile is not loading.
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()
I'm trying to open up my chrome profile which is signed into google however am not having any luck.
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument(r'user-data-
dir=G:\Users\Kareem\AppData\Local\Google\Chrome\User Data\Profile 10')
chrome_path= r"G:\Users\Kareem\Documents\Work\Computer
Science\Selenium\chromedriver.exe"
driver = webdriver.Chrome(chrome_path)
driver.get("https://www.google.co.uk/webhp?source=search_app")
When you create the driver, you're not actually passing the options to it.
driver = webdriver.Chrome(chrome_options=options)
I have the following Python script:
from selenium import webdriver
import time
def main():
chrome_options = webdriver.ChromeOptions();
chrome_options.add_argument("user-data-dir=/Users/octavian/Library/Application Support/Google/Chrome/Default");
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get("https://www.facebook.com/")
time.sleep(1000)
main()
I am trying to load my Facebook profile. However, the page that is opened doesn't have my profile(I'm not logged in), which means the browser state is not loaded.
However, my Chrome profile is stored in this file:
/Users/octavian/Library/Application Support/Google/Chrome/Default
Why is the profile not seen by Selenium?
How I create LOCAL Chrome Webdriver WITH Current user data
chromedriver = "/Users....../chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
options = webdriver.ChromeOptions()
options.add_argument(r"user-data-dir=/Users..../Google/Chrome")
webdriver.Chrome(executable_path=chromedriver,
chrome_options=options)
How I create REMOTE Chrome webdriver with clear - new user data
webdriver.Remote(command_executor="http://192.168.1.30:4441/wd/hub",
desired_capabilities=DesiredCapabilities.CHROME)
Now, How create Remote Chrome webdriver with current user data?
Try this:
os.environ["webdriver.chrome.driver"] = chromedriver
options = webdriver.ChromeOptions()
options.add_argument("--user-data-dir=/Users..../Google/Chrome")
webdriver.Remote("http://192.168.1.30:4441/wd/hub",
options.to_capabilities())
And if you have your chromedriver.exe on the PATH then you should not need this part:
chromedriver = "/Users....../chromedriver"
Not sure if that works for you, but here is an example that let me start remote chrome webdriver with desired chromeOption for language:
options = webdriver.ChromeOptions()
options.add_argument("--lang=de")
chrome_remote = webdriver.Remote('http://hostname:4444/wd/hub', options.to_capabilities())