How to load specific google chrome profile using c# & Selenium chrome driver?How do I calculate someone's age in C#?How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How to loop through all enum values in C#?how to change a button into a imagebutton in asp.net c#How to set up Selenium to work with Visual Studio .NET using C#?Dataset.GetChanges(DataRowState.Modified) return nullC# Directx App crashes in Release
How do we separate rules of logic from non-logical constraints?
How do I present a future free of gender stereotypes without being jarring or overpowering the narrative?
How does a receiver know the exact frequency in the channel to "listen to"?
How did they film the Invisible Man being invisible, in 1933?
Thin wall to block LED light from hitting photodiode?
What do you call a notepad used to keep a record?
Simple logic puzzle
Can a stressful Wish's Strength reduction be cured early by a Greater Restoration spell?
Can a Pact of the Blade warlock turn a cursed magic weapon into your pact weapon to bypass the curse?
How to securely dispose of a smartphone?
pgfmath does not work
What European countries have secret voting within the Legislature?
Discworld quote about an "old couple" who having said everything to each other, can finally go about living their lives
When was this photo of Mission Dolores *actually* taken?
What is quadratization?
How do I tell the reader that my character is autistic in Fantasy?
Word ending in "-ine" for rat-like
Bin Packing with Relational Penalization
Is it possible to have a character with proficiency in all martial weapons without proficiency in Medium armor?
Why isn't UDP with reliability (implemented at Application layer) a substitute of TCP?
Adjective for 'made of pus' or 'corrupted by pus' or something of something of pus
Sharing referee/AE report online to point out a grievous error in refereeing
Is there a legal way for US presidents to extend their terms beyond two terms of four years?
Why would anyone even use a Portkey?
How to load specific google chrome profile using c# & Selenium chrome driver?
How do I calculate someone's age in C#?How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How to loop through all enum values in C#?how to change a button into a imagebutton in asp.net c#How to set up Selenium to work with Visual Studio .NET using C#?Dataset.GetChanges(DataRowState.Modified) return nullC# Directx App crashes in Release
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I need to load my current google chrome profile with all the extensions/cookies/logins & passwords for sites using C# & Selenium chrome driver.
Please help me to put correct code lines in the correct places.
I found some info how people did this with python , but even in those threads there are no answers where to put that code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
IWebDriver Browser;
public Form1()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
IWebElement element;
Browser = new OpenQA.Selenium.Chrome.ChromeDriver();
Browser.Manage().Window.Maximize();
Browser.Navigate().GoToUrl("https://google.com");
Thread.Sleep(3000);
private void button2_Click(object sender, EventArgs e)
Browser.Quit();
Code I provided successfully opens an empty google chrome profile. I need the selenium chrome driver to open google chrome with my google chrome profile instead of empty profile.
c# selenium
add a comment |
I need to load my current google chrome profile with all the extensions/cookies/logins & passwords for sites using C# & Selenium chrome driver.
Please help me to put correct code lines in the correct places.
I found some info how people did this with python , but even in those threads there are no answers where to put that code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
IWebDriver Browser;
public Form1()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
IWebElement element;
Browser = new OpenQA.Selenium.Chrome.ChromeDriver();
Browser.Manage().Window.Maximize();
Browser.Navigate().GoToUrl("https://google.com");
Thread.Sleep(3000);
private void button2_Click(object sender, EventArgs e)
Browser.Quit();
Code I provided successfully opens an empty google chrome profile. I need the selenium chrome driver to open google chrome with my google chrome profile instead of empty profile.
c# selenium
add a comment |
I need to load my current google chrome profile with all the extensions/cookies/logins & passwords for sites using C# & Selenium chrome driver.
Please help me to put correct code lines in the correct places.
I found some info how people did this with python , but even in those threads there are no answers where to put that code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
IWebDriver Browser;
public Form1()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
IWebElement element;
Browser = new OpenQA.Selenium.Chrome.ChromeDriver();
Browser.Manage().Window.Maximize();
Browser.Navigate().GoToUrl("https://google.com");
Thread.Sleep(3000);
private void button2_Click(object sender, EventArgs e)
Browser.Quit();
Code I provided successfully opens an empty google chrome profile. I need the selenium chrome driver to open google chrome with my google chrome profile instead of empty profile.
c# selenium
I need to load my current google chrome profile with all the extensions/cookies/logins & passwords for sites using C# & Selenium chrome driver.
Please help me to put correct code lines in the correct places.
I found some info how people did this with python , but even in those threads there are no answers where to put that code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
IWebDriver Browser;
public Form1()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
IWebElement element;
Browser = new OpenQA.Selenium.Chrome.ChromeDriver();
Browser.Manage().Window.Maximize();
Browser.Navigate().GoToUrl("https://google.com");
Thread.Sleep(3000);
private void button2_Click(object sender, EventArgs e)
Browser.Quit();
Code I provided successfully opens an empty google chrome profile. I need the selenium chrome driver to open google chrome with my google chrome profile instead of empty profile.
c# selenium
c# selenium
edited Mar 25 at 19:28
George
asked Mar 25 at 14:40
GeorgeGeorge
13 bronze badges
13 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Welcome to SO. You can use the chromeoptions.
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=/path/to/your/custom/profile");
Refer to the http://chromedriver.chromium.org/capabilities, for more information.
Make sure to use the chrome option with driver.
IWebDriver driver = new ChromeDriver(options);
Added this with path to my profile straight before this line. Browser = new OpenQA.Selenium.Chrome.ChromeDriver(); Now i got this error: Could not find the type or name of the namespace "ChromeOptions" (perhaps there is no using directive or a link to the assembly)
– George
Mar 25 at 15:15
Refer to seleniumhq.github.io/selenium/docs/api/dotnet/html/…
– supputuri
Mar 25 at 15:25
added using; OpenQA.Selenium.Chrome , now all working again , but still opens an empty google chrome profile. Here is path i added to user-data-dir=C:UsersGeorgeAppDataLocalGoogleChromeUser DataDefault This folder consist of 19 extensions folders , so think it's pasted correctly What's going wrong?.
– George
Mar 25 at 16:12
RemoveDefaultat the end.
– supputuri
Mar 25 at 16:19
Nothing changed , still empty profile.
– George
Mar 25 at 16:29
|
show 6 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55340325%2fhow-to-load-specific-google-chrome-profile-using-c-sharp-selenium-chrome-drive%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Welcome to SO. You can use the chromeoptions.
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=/path/to/your/custom/profile");
Refer to the http://chromedriver.chromium.org/capabilities, for more information.
Make sure to use the chrome option with driver.
IWebDriver driver = new ChromeDriver(options);
Added this with path to my profile straight before this line. Browser = new OpenQA.Selenium.Chrome.ChromeDriver(); Now i got this error: Could not find the type or name of the namespace "ChromeOptions" (perhaps there is no using directive or a link to the assembly)
– George
Mar 25 at 15:15
Refer to seleniumhq.github.io/selenium/docs/api/dotnet/html/…
– supputuri
Mar 25 at 15:25
added using; OpenQA.Selenium.Chrome , now all working again , but still opens an empty google chrome profile. Here is path i added to user-data-dir=C:UsersGeorgeAppDataLocalGoogleChromeUser DataDefault This folder consist of 19 extensions folders , so think it's pasted correctly What's going wrong?.
– George
Mar 25 at 16:12
RemoveDefaultat the end.
– supputuri
Mar 25 at 16:19
Nothing changed , still empty profile.
– George
Mar 25 at 16:29
|
show 6 more comments
Welcome to SO. You can use the chromeoptions.
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=/path/to/your/custom/profile");
Refer to the http://chromedriver.chromium.org/capabilities, for more information.
Make sure to use the chrome option with driver.
IWebDriver driver = new ChromeDriver(options);
Added this with path to my profile straight before this line. Browser = new OpenQA.Selenium.Chrome.ChromeDriver(); Now i got this error: Could not find the type or name of the namespace "ChromeOptions" (perhaps there is no using directive or a link to the assembly)
– George
Mar 25 at 15:15
Refer to seleniumhq.github.io/selenium/docs/api/dotnet/html/…
– supputuri
Mar 25 at 15:25
added using; OpenQA.Selenium.Chrome , now all working again , but still opens an empty google chrome profile. Here is path i added to user-data-dir=C:UsersGeorgeAppDataLocalGoogleChromeUser DataDefault This folder consist of 19 extensions folders , so think it's pasted correctly What's going wrong?.
– George
Mar 25 at 16:12
RemoveDefaultat the end.
– supputuri
Mar 25 at 16:19
Nothing changed , still empty profile.
– George
Mar 25 at 16:29
|
show 6 more comments
Welcome to SO. You can use the chromeoptions.
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=/path/to/your/custom/profile");
Refer to the http://chromedriver.chromium.org/capabilities, for more information.
Make sure to use the chrome option with driver.
IWebDriver driver = new ChromeDriver(options);
Welcome to SO. You can use the chromeoptions.
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=/path/to/your/custom/profile");
Refer to the http://chromedriver.chromium.org/capabilities, for more information.
Make sure to use the chrome option with driver.
IWebDriver driver = new ChromeDriver(options);
edited Mar 25 at 19:50
answered Mar 25 at 15:00
supputurisupputuri
4,7111 gold badge8 silver badges20 bronze badges
4,7111 gold badge8 silver badges20 bronze badges
Added this with path to my profile straight before this line. Browser = new OpenQA.Selenium.Chrome.ChromeDriver(); Now i got this error: Could not find the type or name of the namespace "ChromeOptions" (perhaps there is no using directive or a link to the assembly)
– George
Mar 25 at 15:15
Refer to seleniumhq.github.io/selenium/docs/api/dotnet/html/…
– supputuri
Mar 25 at 15:25
added using; OpenQA.Selenium.Chrome , now all working again , but still opens an empty google chrome profile. Here is path i added to user-data-dir=C:UsersGeorgeAppDataLocalGoogleChromeUser DataDefault This folder consist of 19 extensions folders , so think it's pasted correctly What's going wrong?.
– George
Mar 25 at 16:12
RemoveDefaultat the end.
– supputuri
Mar 25 at 16:19
Nothing changed , still empty profile.
– George
Mar 25 at 16:29
|
show 6 more comments
Added this with path to my profile straight before this line. Browser = new OpenQA.Selenium.Chrome.ChromeDriver(); Now i got this error: Could not find the type or name of the namespace "ChromeOptions" (perhaps there is no using directive or a link to the assembly)
– George
Mar 25 at 15:15
Refer to seleniumhq.github.io/selenium/docs/api/dotnet/html/…
– supputuri
Mar 25 at 15:25
added using; OpenQA.Selenium.Chrome , now all working again , but still opens an empty google chrome profile. Here is path i added to user-data-dir=C:UsersGeorgeAppDataLocalGoogleChromeUser DataDefault This folder consist of 19 extensions folders , so think it's pasted correctly What's going wrong?.
– George
Mar 25 at 16:12
RemoveDefaultat the end.
– supputuri
Mar 25 at 16:19
Nothing changed , still empty profile.
– George
Mar 25 at 16:29
Added this with path to my profile straight before this line. Browser = new OpenQA.Selenium.Chrome.ChromeDriver(); Now i got this error: Could not find the type or name of the namespace "ChromeOptions" (perhaps there is no using directive or a link to the assembly)
– George
Mar 25 at 15:15
Added this with path to my profile straight before this line. Browser = new OpenQA.Selenium.Chrome.ChromeDriver(); Now i got this error: Could not find the type or name of the namespace "ChromeOptions" (perhaps there is no using directive or a link to the assembly)
– George
Mar 25 at 15:15
Refer to seleniumhq.github.io/selenium/docs/api/dotnet/html/…
– supputuri
Mar 25 at 15:25
Refer to seleniumhq.github.io/selenium/docs/api/dotnet/html/…
– supputuri
Mar 25 at 15:25
added using; OpenQA.Selenium.Chrome , now all working again , but still opens an empty google chrome profile. Here is path i added to user-data-dir=C:UsersGeorgeAppDataLocalGoogleChromeUser DataDefault This folder consist of 19 extensions folders , so think it's pasted correctly What's going wrong?.
– George
Mar 25 at 16:12
added using; OpenQA.Selenium.Chrome , now all working again , but still opens an empty google chrome profile. Here is path i added to user-data-dir=C:UsersGeorgeAppDataLocalGoogleChromeUser DataDefault This folder consist of 19 extensions folders , so think it's pasted correctly What's going wrong?.
– George
Mar 25 at 16:12
Remove
Default at the end.– supputuri
Mar 25 at 16:19
Remove
Default at the end.– supputuri
Mar 25 at 16:19
Nothing changed , still empty profile.
– George
Mar 25 at 16:29
Nothing changed , still empty profile.
– George
Mar 25 at 16:29
|
show 6 more comments
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55340325%2fhow-to-load-specific-google-chrome-profile-using-c-sharp-selenium-chrome-drive%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown