How to make chromedriver remember my settings for launching an app trough the browser with python selenium? - python-3.x

I am making an app with Selenium and Chromedriver on Python 3.6.3,
the app opens a magnet torrent link, but the browser always asks if the user wants to launch BitTorrent("remember my choice" does not work obviously).
I want to make the whole browser invisible with the --headless flag once i'm done coding the app, so the user will not be able to click that if i decided to just leave it as it is. Could someone please tell me how to make it so that chromedriver remembers to allow launching apps through the browser? I've been looking a lot and can't find any solution. Thanks in advance for any help.

By default, ChromeDriver will create a new temporary profile for each session. In your case, you could use a custom profile (in which your BitTorrent setting is saved).
In your code tell chromedriver where the profile is located, like this:
from selenium.webdriver.chrome.options import Options
...
chrome_options = Options()
chrome_options.add_argument("user-data-dir=/path/to/your/custom/profile");
...
driver = webdriver.Chrome(chrome_options=chrome_options)

Related

Is is possible to initialize a new driver in already opened chrome browser page?

Is is possible to initialize a new driver in already opened chrome browser page?
If it does, can anyone please mention how?
Thanks
Watir starts a browser session by sending specific capabilities to the browser driver. While it is theoretically possible that there is a way to tell the driver to connect to an existing session, it is explicitly not supported by the specification, and its usage would be actively discouraged by the Selenium / WebDriver / Watir projects.

Activating / clicking a browser extension in Firefox with Selenium in Python 3

I am writing a script for web automation with SELENIUM and, in theory, I have two options to capture the data I need from the websites I am scraping:
I can let the script extract relevant information from each tag on the result pages.
I can make the script click on the browser extension button in my browser window and let the extension manage the data for me.
I know how to extract information by HTML tag, but when it comes to browser extensions, I have only found instructions how to install / uninstall them with SELENIUM, but no instructions how to "activate" them once they are installed.
I am using Firefox and would be very grateful if you could point me in the right direction.
I was not able to solve this problem in FIREFOX but in CHROME:
I created a browser profile including my extension and a key shortcut to activate it.
I opened that profile when starting the browser with SELENIUM.
I used SELENIUM to navigate to the right URL.
I used pyautogui to press the relevant keys and trigger the file download.

Python - Using a browser other than Chrome with webbot package

I am new to programming and my first task, which should be really simple, is to automate a proccess, where I log in in a website with my credentials, I click on some buttons and that is it. I am using Python 3.6 on windows 10.
I am trying to do it using the webbot module, which so far has come really handy but I have one big problem.
The standard browser for webbot is Google Chrome and thus the site always opens with Chrome. I need to open the site with Internet Explorer.
I have set IE as default browser, but nothing changed, Chrome would still open.
I deleted Chrome, but then when I would run the programm nothing would happen.
I checked the init.py file and the drivers folder of the module and I think that this module can only work with chrome.
Is it possible to use IE or does this mean that this package does not support this browser at all?
Which alternatives would you suggest?
Edit: If I am not mistaken Selenium does not support IE11 on windows 10, so that is not an option, unless I am mistaken.
Thanks in advance
There is no support for another browser other than Chrome (as far as the webbot module is concerned).

Editing already open website Selenium

I want to mimic mouse clicks on buttons etc. on a website which is already open in a browser(e.g. Chrome). Do you guys know if I can do this with Selenium? Or do you guys know how I can do this in general?
No, you have to launch the browser with selenium by initializing the driver. Selenium is proxying the browser so that your code can control it.
http://selenium-python.readthedocs.io/getting-started.html

Automating Google chrome extenions with sahi

We are automating chrome extension with sahi.
we have loaded our chrome profile with sahi with extension added on profile.
we weren't able to get dom elements of extensions.
so we are navigating to the url: chrome-extension:/extension_id/popup.html
but sahi doesn't navigate to this url.
but i have read with selenium we are able to get it.
Please help me out, with this automation
I'm not sure, I understand the problem here. But if you want to change some options on chrome. I use this Chromium Command Line Switches to find correct option to set when set browser on 'browser_types.xml`.
For example:
<options>--no-default-browser-check --user-data-dir=$userDir\browser\chrome\profiles\sahi$threadNo --proxy-server=127.0.0.1:$port --disable-popup-blocking --always-authorize-plugins --allow-outdated-plugins --enable-npapi --incognito</options>

Resources