How to connect Selenium to an existing browser that was opened

1,470 views
Skip to first unread message

Frank

unread,
Oct 20, 2019, 1:49:45 PM10/20/19
to Selenium Users
1. I type this command line to open a chrome:
chrome.exe --remote-debugging-port=9222  --user-data-dir="C:\selenum\AutomationProfile
I can open it and chrome can work well

2. then i write below code to connect the chrome.
ChromeOptions options = new ChromeOptions();
options.DebuggerAddress = "127.0.0.1:9222";
options.AddArgument("no-sandbox");
//options.AddArgument("proxy-server='direct://'");
//options.AddArgument("proxy-bypass-list=*");
ChromeDriverService service = ChromeDriverService.CreateDefaultService(Environment.CurrentDirectory);
service.HideCommandPromptWindow = true;
driver = new ChromeDriver(service, options, TimeSpan.FromSeconds(130));


then i got a exception and the error message is :
OpenQA.Selenium.WebDriverException: 'unknown error: cannot connect to chrome at 127.0.0.1:9222
from chrome not reachable'

Also i can open another chrome window and type url "localhost:9222", it can work well, so 127.0.0.1:9222 must be reachable. So 
i do not know how to resolve this prolem.

Is there anyone can help me ?

Thanks a lot.

Suresh Somisetty

unread,
Oct 20, 2019, 5:49:53 PM10/20/19
to seleniu...@googlegroups.com
Hello,
Did any one leveraging open shift for Selenium GRID for CI/CD execution?
Please let me know if there are any reference links or details on how to setup and usage.

Thanks
Suresh

salahuddin owais

unread,
Jul 29, 2020, 4:05:47 AM7/29/20
to Selenium Users
Reply all
Reply to author
Forward
0 new messages