Headless Google Chrome Proxy Server Settings - selenium

I'm using Selenium webdriver with Google Chrome. This is the code I was using to set the proxy for chrome:
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % my_proxy)
This code worked for months. I'm coming back now and it is not working... I've tried older versions of Selenium, Chrome, Chromium, and the webdriver. None of the changes I do seem to work :(
Additionally, running chrome.exe from the command line while passing --proxy-server does not work! Chrome silently ignores the passed proxy...
Does anyone have any idea what is going on here? I've spent days trying to figure out how to get this simple selenium script working... Thanks so much :)
EDIT: I just tried running chrome.exe with the --proxy-server flags on a friend who has the same computer as mine and it worked...

This was one of the chrome extensions I had installed... If chrome.exe --proxy-server=xxx is not working try removing all extensions.
Hopefully no one else has to waste 3 days on this :(

Related

Chomedriver selenium doesn't work under vpn

I encountered an issue rather strange. When I run python scripts with selenium under fortinet vpn they get stuck. It never gets past "data:," at the address bar. How fortinet detects chromedriver?
Example code:
from selenium import webdriver
browser = webdriver.Chrome('/usr/local/bin/chromedriver')
browser.get('https://www.google.com/')
No VPN:
https://i.stack.imgur.com/IFBF1.png
with VPN:
https://i.stack.imgur.com/WcE0W.png
update 1
Tried modifying _cdc as suggested in this question but had no progress:
Can a website detect when you are using selenium with chromedriver?
update 2
Just tried using Firefox and Safari. Both work fine under the VPN. It definitely blocks chromedriver on some way.

Running chrome via selenium

I did it earlier but I can't use chrome via selenium now. Browser opens for a few seconds then closes and then I got an error (about 5 minutes later):
Message: session not created
from disconnected: unable to connect to renderer
(Session info: chrome=70.0.3538.67)
(Driver info: chromedriver=2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d),platform=Linux 4.18.14-arch1-1-ARCH x86_64)
I use following code for running browser (which I always use):
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
opts = Options()
browser = Chrome(options=opts)
Chromedriver directory is in the PATH. Versions of chrome and chromedriver you can see in the error. Python 3.7.0, selenium==3.14.0. What's wrong in my actions?
P.S. BTW, It works fine with Firefox
Your versions look compatible with each other based on the compatibility list, so I don't think it has to do with that. I have not seen those options used in that way before though.
Please try this:
from selenium import webdriver
ChromeOptions = webdriver.ChromeOptions()
browser = webdriver.Chrome(chrome_options=ChromeOptions)
browser.get("https://www.google.com")
browser.quit()
Let me know if that is able to open your browser. If it is, then I am assuming you are having issues with some of the options you are passing chrome.
If you are still have issues after checking all the options you are passing chrome, try rolling back your chromedriver version HERE to 2.42. It should still be compatible with chromer version 70.-.
I am on the same versions as you, and I'm not experiencing this issue.
A couple other things to think about:
Are you using headless chrome? If so switch to non-headless and test.
Make sure to close out of all instances of chromedriver before updating with another version.
If chrome recently updated, or you recently updated your driver, try
restarting the machine.
Actually I don't know why, but it works fine now. Everything I did are recommendations from the answer above. It didn't work right after my actions but now it's okay

Selenium IE Webdriver send slowkeys even though changed to 32Bit

I have a serious Problem, and i tried about 20 workarounds which completely failed to work as a solution for me.
MainProblem: I execute a testsuite parallel on 3 different browsers, Chrome, Firefox and IE11. While sendKeys() works perfectly fine on chrome and Firefox, on IE every letter takes about 5 seconds to appear, so a normal login-procedure which takes about 2 sec on chrome takes about 50 on IE...
I work on a mac. On the Mac, i have a WindowsPC (Win10) in a VM via Parallels. On this, i installed JDK, Eclipse, and try to automate a webpage via Selenium+Testng.
IE Version: 11.192.16299.0
I set the security level to low for trusted and local intranet, i removed the save-mode checkbox. I got the well known slow-sendKeys-Problem. But for most of the internet it worked with changing the IEWebdriver from 64-> 32Bit. It simply doesnt make any difference and i struggle here.
I really need help. Please let me know if you need any insight, logs or whatever, i try to provide with everything fast.
Best Greets!
By setting up the following options It should resolve the problem:
System.setProperty("webdriver.ie.driver", "./path/IEDriverServer.exe");
InternetExplorerOptions options = new InternetExplorerOptions();
options.introduceFlakinessByIgnoringSecurityDomains();
options.requireWindowFocus();
WebDriver driver = new InternetExplorerDriver(options);

FireFox still not working for Protractor/Selenium tests?

I have a project suite of automation tests that uses Protractor and Jasmine. As of a couple months ago, my tests stopped working in FireFox. Everything works perfectly in Chrome, and almost perfectly in IE.. because why would IE work ya know.
There have been multiple posts about this and I've read through all of them, but I haven't been able to determine if there's a workaround/solution to this. It's not entirely a HUGE deal if my tests run in FireFox, but with a web application it's mighty nice to be able to test all instances.
Basically what happens when I run a test in FireFox:
Command prompt acts like everything is about to run properly (FireFox driver starts up.. server remains running etc etc)
Firefox opens for a split second (icon appears on the task bar, browser flashes on the screen and closes)
After a good minute or so protractor gives me the following message:
[firefox #01-0] WebDriverError: Unable to connect to host XXX on port XXX
after 45000 ms.
With a ton of DEBUG lines referring to JSON files and Firefox addons.
Any thoughts or other sources I could check out would be sweet. Many thanks in advance.
Problem is with latest Firefox support from latest selenium-server. Use geckoDriver and it will work.
Follow this URL

Firefox v45 doesn't start on it own

I recently uninstalled Mozilla Firefox v47 becuase it was not working with Selenium WebDriver. I then installed Firefox v45.0 which is working successfully with Selenium WebDriver.
The problem is that now, cant open Firefox on it own. I double click the application icon and nothing happens. I have tried to run it as an admin, from the program files folder and still nothing happens.
I have no idea how to identify what's wrong.
Any help will be appreciated.
I had the same problem, try to install version 46 of Firefox (it works with the latest version of selenium WebDriver) :
https://ftp.mozilla.org/pub/firefox/releases/46.0.1/