Disable ONLY Chrome Automation Extension in Selenium - python

I've been researching this extensively but i have yet to even find a single topic about this specific question. I use python to access Selenium Webdriver, and have been disabling the extensions through python using the code
chrome_options.add_argument("--disable-extensions")
Recently though, i've wanted to load a custom profile, and that means custom extensions. is there a way to get rid of ONLY the automation extension?
ALSO, as a follow up curiosity, what even makes the chrome browser automatically start out with this extension loaded?
Thanks!

You can disable the Chrome Automation Extension by adding an experimental option to ChromeOptions like so:
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);

Related

Keep changes made to firefox extensions through Selenium

My goal is to use Selenium to configure an extension in Firefox programmatically.
What I did is the following:
Load my default Firefox profile, so that my Selenium session has access to my extensions.
Use Selenium to navigate to the extension's configuration page (moz-extensions://*********************/options/)
Use selenium to automate the configuration process and save.
My only issue is that my changes are lost. That is, upon starting Firefox again (like a "normal" user), none of the changes I made are kept.
Is there a way to ensure that Selenium saves the changes to my profile?

Watching JS Variables with Selenium Firefox

I want to be able to interface with Javascript variables like I can in chrome with Selenium using python. What should I be looking to use for this, I'm lost.

How do I access Chromium extension API from Selenium Webdriver?

Is it possible to make a chromium extension that would expose an API to python selenium webdriver code? For example, I can make an extension with a background script, that would count the tabs with chrome.tabs.query, now I'd like to access that information from my python code using selenium webdriver.
I've been able to do this by querying background script from content script using chrome.extension.sendMessage, saving the data to window.localStorage, and fetching it to python with Command.GET_LOCAL_STORAGE_ITEM (or execute_script, doesn't matter), but is there a simpler way?

Is possible to use Selenium with Python, for Electron apps?

I am pretty new to the Selenium testing with Electron apps; I know how to use Python to drive Chrome via the webdriver, and how to use Selenium IDE on Firefox, but I am having trouble to find a good source of info.
So far I have an app made with Electron, and I would like to use Selenium to drive it and automate the basics. I did some research and most of the results were using node.js, which I do not know at all. I would like to use Python, so before moving on a whole different language, I would like to ask to a bigger audience, if there is something already to do Selenium testing with Python, on Electron apps
In particular, how do you assign the variable that will contain the electron app? with the browser I would say
from selenium import webdriver
driver = webdriver.Chrome('/chromedriver')
but this won't make sense for an electron app.
I did find a way to catch the application.
You need to download Chromedriver; and run it on a port that you like(example: 8765).
Then you can access the application written via Electron, in Python using
from selenium import webdriver
remote_app = webdriver.remote.webdriver.WebDriver(
command_executor='http://localhost:8765',
desired_capabilities = {'chromeOptions':{ 'binary': '/myapp'}},
browser_profile=None,
proxy=None,
keep_alive=False)
Then you can access the DOM elements on the app as usual. Not sure if it will work on Windows, OSX and Linux, will have to try.
Yes you can do it with driver options and capabilities.
You need to set binary path and you should add Arguments on options.
Binary path is your electron application path under project directory in '.bin'.
Argument path is your project's main directory.
For example :
Let's say, your project under home directory and named 'ElectronProject'
Binart path is '/Users/Home/ElectronProject/node_modules/.bin/electron'
Argument Path is '/Users/Home/ElectronProject'
Yes, It is possible. you can refer the documentation # https://electronjs.org/docs/tutorial/using-selenium-and-webdriver

Is there any inbuilt browser for web automation using python?

I have tried splinter for browser automation. Used firefox webdriver in splinter. But the problem is high CPU usage when the firefox loads and sometimes its hangs the gui. Please suggest me an option. I'm in a Linux box(Ubuntu) and building an app using pygtk.
Selinum with phantomjs should be a good replacement of splinter.

Categories

Resources