Nilesh Sharma
Nilesh Sharma

Reputation: 1

How to execute Selenium scripts on already opened browser in Mac OS

//cd /Applications

//Google\ Chrome.app --remote-debugging-port=6655 --user-data-dir=/Users/admin/Documents/chromedata

These above commands are not working when entered in terminal getting error as-- Google Chrome.app not found

Upvotes: 0

Views: 1645

Answers (1)

Alexandru Bucur
Alexandru Bucur

Reputation: 86

I'm getting the work done in C#.

First of all, in order to attach to an already existing Chrome session, you have to launch Chrome with some parameters, for example:

chrome.exe https://www.youtube.com --new-window --remote-debugging-port=9222

The most important thing is to specify the remote debugging port. After that, you have to create a new istance of ChromeDriver passing the localhost IP and the remote debugging port specified above to chrome.

I don't know what language you have to write... so I'm doing it in C#.

ChromeOptions option = new ChromeOptions();
option.DebuggerAddress = "127.0.0.1:9222";

ChromeDriver driver = new ChromeDriver(option);

After that, you can do the work as always.

Upvotes: 1

Related Questions