how to get the flags that chrome was launched with - automation

so am launching connection a puppeteer instances to an already opened chrome and then logging in to my Gmail account, as you know if I used the same user-data-dir. it would launch with an already signed in Gmail account, what I want to do is automatically harvester the user-data-dir from the chrome instances so I can use them after a while, so I don't want to manually enter chrome://version to get it
am connecting puppeteer to chrome in this way :
const browserURL = `http://127.0.0.1:${port}`;
const browser = await puppeteer.connect({browserURL, defaultViewport : null });
const page = await browser.newPage();

Related

Error: The specified executable path does not exist: /tmp/.mount_JobAppuO0ICL/resources/app.asar/dist/main/chromedriver/chromedriver

I am trying to use Selenium and Chrome WebDriver in Electron, which works fine in development. However, once I package the application and run it, I get the following error:
Error: The specified executable path does not exist: /tmp/.mount_JobAppuO0ICL/resources/app.asar/dist/main/chromedriver/chromedriver
Here's the code that starts the driver:
const service = new chrome.ServiceBuilder(path).build();
chrome.setDefaultService(service);
const options = new chrome.Options();
options.options_.debuggerAddress = "localhost:9222";
this.driver = await new Builder()
.withCapabilities({ unexpectedAlertBehaviour: "accept" })
.forBrowser("chrome")
.setChromeOptions(options)
.build();
Where path is from require("chromedriver").path.
I'm not using selenium and chrome driver to test Electron app. I'm using selenium and chrome driver for functionality inside Electron app.
Thank you

edge web driver cant open whatsapp web

im trying this code to open web.whatsapp.comm on my edge driver
var options = new EdgeOptions();
options.AddArgument(#"user-data-dir= .......");
options.AddExcludedArgument("enable-automation");
options.LeaveBrowserRunning = true;
EdgeDriverService driverService = EdgeDriverService.CreateDefaultService();
driverService.HideCommandPromptWindow = true;
var driver = new EdgeDriver(driverService, options);
driver.Navigate().GoToUrl("https://web.whatsapp.com/");
it load normaly first time and i log in my whatsapp account by scanning QR-code, and it work normal.
second time, i close program and run again and it shoud login directly becuse i save profile by option argument.
but in secend time web page does not load and stock on loading page.
im using edge browser version 103.0.1264.44 and driver version 103.0.1264.44

Using Selenium C# DevTools how to capture f12 options (Network) with c#

Capture F12 options using Selenium C# DevTools, need help on C# SELENIUM, Attached snapshot
Using Selenium C#, collect logs from F12 options on any website,
For example open google.com in chrome and press F12, right side you will see developer options, capture those network logs using selenium C#. Attached snapshot what to capture
Here is the code to access the Network tab. Below code block the css/jpg/png image on the website, you can use any Network method to collect logs or implement according to the requirement.
chromeDriver = new ChromeDriver();
IDevTools devTools = iConstants.chromeDriver as IDevTools;
IDevToolsSession session = devTools.GetDevToolsSession();
var domains = session.GetVersionSpecificDomains<DevToolsSessionDomains>();
await domains.Network.Enable(new Network.EnableCommandSettings());
await domains.Network.SetBlockedURLs(new DevTools.Network.SetBlockedURLsCommandSettings()
{
Urls = new string[] { "*://*/*.css", "*://*/*.jpg", "*://*/*.png" }
});
chromeDriver.Manage().Window.Maximize();
chromeDriver.Url = "https://google.com";

ChromeDriver Access To Mic/Camera For Selenium Test

I’m trying to run an end to end test for a video chat platform, using the ChromeDriver. I need to use the actual webcam stream on my computer to run the test. I’ve tried both versions of the following code, but neither actually defaults the mic/camera settings to allow.
let options = new Options();
options.set("preferences.profile.content_settings.exceptions.media_stream_camera.'<localhost-address>,*'.setting", 1)
options.set("preferences.profile.content_settings.media_stream_mic.'<localhost-address>,*'.setting", 1);
let driver = await new Builder().setChromeOptions(options).forBrowser("chrome").build();
let options = new Options();
options.setUserPreferences({"preferences.profile.content_settings.exceptions.media_stream_camera.'<localhost-address>,*'.setting": 1,
"preferences.profile.content_settings.media_stream_mic.'<localhost-address>,*'.setting": 1});
let driver = await new Builder().setChromeOptions(options).forBrowser("chrome").build();
The pop-up still comes up and I can’t find a way to interact with it. Using a fake device/UI doesn’t resolve the issue, because it’s incompatible (to my knowledge) with Twilio, which the platform also uses.
Does anyone know how to default the ChromeDriver to allow camera/mic access during testing?
Update: The following code runs so that the pop up doesn't appear. But when the driver gets to the point that pop up would show up, the browser instance quits and the test ends. Is it impossible to stream from a webcam via Selenium?
let options = new Options();
options.setUserPreferences({"profile.default_content_setting_values.media_stream_mic": 1,
"profile.default_content_setting_values.media_stream_camera": 1});
let driver = await new Builder().setChromeOptions(options).forBrowser(browser).build();

protractor not able to open new tab window which contains pdf tab

While testing one angular website there is button, When i am clicking on it - It should open new tab which contains pdf.
What i tried - Manual Execution working properly
1) I used JAVA script Executor but it's not working.
browser.executeScript("document.querySelector('My Query Selector').click();");
2) simple click also not opening new tab in chrome protractor testing
const elm = element(by.xpath("//button[#class='My Class Name']"));
elm.click();
chrome Version = Version 74.0.3729.169 (Official Build) (64-bit)
browser.addMockModule('Infrastructure.SignalR', () => {
angular.module('Infrastructure.SignalR', []);
});
does this browser.addMockModule affects to not opening new tab ?
Try using Control+Click to check whether it is working.
const elm = element(by.xpath("//button[#class='My Class Name']"));
Actions action=new Actions(driver);
action.keyDown(Keys.CONTROL).click(elm).keyUp(Keys.CONTROL).build().perform();