Selenium browser capability fontSize - selenium

Is it possible to change the fontsize of the browser through capabilities? if so how?
manually we can set it from chrome>>Settings>> Appearance>> font Size..
so, wanted to set it at initial launch of browser and work.
Had tried to find it in chromeOptions but couldn't
https://sites.google.com/a/chromium.org/chromedriver/capabilities
any possibility?
Couldnt tag, webdriverJS.
i am using typescript for webdriverJS API

Related

Selenium JavaScript executor for shadow root element works fine in normal browser but does not work in chrome headless browser

I'm testing a chrome extension using selenium 4.3.0 with Java and to open a chrome extension I have to get extension id which keeps on changing for every new build developers provide. To overcome this and not hardcode extension id in code, I though to fetch it from chrome extension page. For that I have to deal with #shadow-root (open) element.
Below is image of HTML structure with element highlighted with box which I want to fetch.
I'm trying below code to fetch id which works perfectly fine when using chrome browser with UI.
JavascriptExecutor js = (JavascriptExecutor) driver;
WebElement webElement = (WebElement) js.executeScript("return document.querySelector(\"body > extensions-manager\").shadowRoot.querySelector(\"#items-list\").shadowRoot.querySelector(\"extensions-item\")");
But when I use headless mode to launch chrome browser with below code
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
chromeOptions.addExtensions(new File("Chrome_Extension.crx"));
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver(chromeOptions);
all of a sudden same code stops working and I'm getting error:
org.openqa.selenium.JavascriptException: javascript error: Cannot read properties of null (reading 'shadowRoot')
Any help on why would it work on normal mode but not in headless mode would be highly appreciated.
Alternatively if someone has a better approach to fetch extension id of a chrome extension, then please do let me know.
Actually I got it to work, it seems chromeOptions.addArguments("--headless"); does not work for chrome extensions. Updating it to
chromeOptions.addArguments("--headless=chrome");
works just perfect.
Got this information from here

Can you enable a color picker on safari dev tools?

Is there a way to enable the color picker on safari dev tools web inspector? Or even change the format of the color from RGB? I know you can do both of these on Google Chrome (see second screenshot)

Chromium selenium webdriver disable zoom-in option

I am trying to find a way to disable zoom in option in selenium webdriver, I am using chromium and there is no command line switch for this in docs, browser is in kiosk mode with touchscreen and user are able to zoom-in with two fingers, how to prevent that?

Get access to Electron API from Java and Webdriver

I'm writing automation tests for Electron application using Java->Selenide (Selenium)->chromedriver 83.
I can successfully get access to visual elements of the app using xpath locators. But currently I need to check that window of my app is minimized after pressing "Minimize" UI button.
I can't find any easy ways to check that window is minimized from chromedriver.
May I use Electron API to get property win.isVisible or something like that? Or maybe any other ways to check that window of the Electron app is minimized?
Thanks

testing using selenium: chrome screensharing auto select tab and share with audio

I am testing my website using Selenium and I am able to open chrome with --auto-select-desktop-capture-source="tab_name" and select the tab when screen share is enabled. Now I want the audio playing in the tab to be in my stream along with the video. While doing it manually there is a checkbox which enables audio sharing but is there something which can help enable it from Selenium?
Here is a fiddle: https://jsfiddle.net/john_vera/yr2k9xob/5/
Notice the Share Audio checkbox after selecting chrome tab in the dialog. I want to check that from Selenium.
You could create an custom chromium build and implement an bypass for this dialog. To build chromium you can use these instructions (for windows): Here
Here the bypass in file display_media_access_handler.cc:
Look for this line:
// Orignal code
pending_request.picker->Show(picker_params, std::move(source_lists), std::move(done_callback));
And replace it with this
// Bypass dialog
content::DesktopMediaID screenSource(content::DesktopMediaID::TYPE_SCREEN, content::DesktopMediaID::kNullId, web_contents);
screenSource.audio_share = true;
OnPickerDialogResults(web_contents, screenSource);
// End of bypass
I testet it with Chromium Version 84.