I am struggling through what appear to be issues with WebDriver properly interacting with the Internet Explorer Server (IE11). I have quite a number of tests already authored and working in Chrome but when I try to run the exact same tests using the latest IE Driver server (2.46.0 - downloaded from http://www.seleniumhq.org/download/)
I have read a number of articles on setting up a registry entries and adding my site to the list of trusted sites to to possibly handle a few of these issues but I have been un-successful (Selenium WebDriver on IE11)
Within the page above, one of the responses links to a Microsoft site for downloading IE Web Driver for IE 11 (http://www.microsoft.com/en-us/download/details.aspx?id=44069), this link wants to download and install something.
My question: Is there a difference in the WebDriver from the Selenium site versus the MS site?
Thanks
Sean
Try disabling the native event for IE shown as follows
var options = new InternetExplorerOptions { EnableNativeEvents = false };
options.AddAdditionalCapability("disable-popup-blocking", true);
Driver = new InternetExplorerDriver(options);
Also, DesireCapabilities expands the ability of controlling driver instance more.
Related
im looking example how can i start my normal google chrome in webdriver c#?
For now i use :
ChromeDriver driver;
public ChromeDriverService chromeDriverService;
chromeDriverService = ChromeDriverService.CreateDefaultService();
chromeDriverService.HideCommandPromptWindow = true;
var chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("disable-infobars");
chromeOptions.AddExcludedArgument("enable-automation");
chromeOptions.AddAdditionalCapability("useAutomationExtension", false);
driver = new ChromeDriver(chromeDriverService,chromeOptions);
But it run my chromedriver.exe installed inside project. Can i just run my simple installed chrome? Without download any chromedriver.exe? It's important for me , because some website check if there is opened chromium with chromedriver.exe.
Is it possible to do that?
If you want not just open it but also perform some interaction with your site then you have to deal with Selenium and WebDriver.
You can try Python and undetected-chromedriver which has some workarounds preventing some systems to detect that your browser is running under webdriver control.
Unfortunately, it's the chromedriver.exe that lets you interact with Chrome so, without the driver, you wouldn't be able to interact with the actual browser.
If your issue is with chromium, try driving Mozilla with GeckoDriver
Selenium always uses chromedriver.exe for interacting with Chrome, I think you mean you want to load your default data directory. You can add a chrome option for this purpose:
chromeOptions.AddArguments(#"C:\Users\<your user name>\AppData\Local\Google\Chrome\User Data")
Take care, any other chrome must not be running that time with the same data directory. Like you may have run for your personal use.
You can also create a data directory somewhere else if you just want to show some realistic behavior to a website. But some websites are smart enough so it does not work every time.
I know, that such a question is already asked here before, but it is 4 years old and not quite helpful.
So, what i want to do is simple, i want my selenium (running in WPF and .Net 5.0 in c#) so connect to an open browser to control it. The browser is opened manually with the debuggingport 9222 and i can successfull connect to this browser from another browser instance.
i am able to open a NEW Chrome browser with selenium and control it, but i need to also have the ability to connect to an open instance.
and help would be awesome.
PS: i know that selenium is for testing, and normally not used to not be in a controlled test-environment. =)
thank you so much for you help guys.
Type : chrome://version/ in browser you will get executable path of chrome.exe
copy this and close all chrome instance.
**close all chrome instance and **
start chrome as:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=5555
verify chrome is started with port open by going to localhost:5555
Now add remote debugging port as:
var options = new ChromeOptions();
options.debuggerAddress= "127.0.0.1:5555";
var driver = new ChromeDriver(options);
use chrromeoptions to connect to that port from selenium
We are doing the Continuous integration using C# selenium for web base application. We have trigger the script from TFS using the test agent. But the build or the execution is getting successful if the browser type is chrome. For the IE bower we are facing the issue. Please help us in resolving this issue.
Note: When we trigger manual execution from server , execution in IE happens successfully.
Below is my Exception screenshot.
enter image description here
Seems it related to the Webdriver.
Just try below things to check if that works for you:
1 .Try the latest IE
2 .Include setting capabilities of the browser when starting it. Try the below settings and see if it works to help it stay focused on the newly opened window.
capabilities = new DesiredCapabilities();
capabilities.setCapability("ignoreProtectedModeSettings", true);
capabilities.setCapability("ie.ensureCleanSession", true);
webDriver = new InternetExplorerDriver(capabilities);
3 .Edit the browser profile and increase timeout to 180 seconds or more from default 60 seconds. Please note that this constructor is available in .Net API only.
For internet explorer driver, you can use below syntax.
driver = new InternetExplorerDriver(#"z:\seleniumc", new InternetExplorerOptions(),TimeSpan.FromMinutes(5));
Refer to Selenium Webdriver for details.
Hello (first time posting here),
I am having trouble getting geckodriver to bypass certificate errors. I've done a lot of research and made sure that I have the latest versions of all components. Reason I stress that is because a lot of the past questions that exist on this site discuss obsolete methods such as using DesiredCapabilities.
This is my code:
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
FirefoxProfile profile = new FirefoxProfile("QA"){
AcceptUntrustedCertificates = true
};
FirefoxOptions options = new FirefoxOptions(){
Profile = profile
};
var driver = new FirefoxDriver(options);
driver.Navigate().GoToUrl("https://google.ca");
The code above fails and I still get certificate errors on Firefox. One thing I noticed when debugging it is that the driver still sees the capability "acceptInsecureCerts" as "false". Screenshot below.
Am I doing something wrong? Please advise.
I am currently using:
Selenium V3.9 (latest)
Mozilla Firefox Nightly 60.0a (latest)
geckodriver 19.1 (latest)
Aah! Found it: Firefox Options has an "addcapabilities" function that fixes it.
options.AddAdditionalCapability("acceptInsecureCerts", true, true);
Since geckodriver v0.16.0 flashplayer is disabled by default.
Is there any possibility to start firefox with enabled flashplayer?
I'm using C#. My code right now:
var profileManager = new FirefoxProfileManager();
FirefoxProfile profile = profileManager.GetProfile("selenium"); //created firefox user named selenium
profile.SetPreference("plugin.state.flash", 1);
Code bellow doesn't work for me:
profile.SetPreference("dom.ipc.plugins.enabled.libflashplayer.so", true);
When I use this one:
profile.SetPreference("plugin.state.flash", 1);
firefox is asking if I want to enable flashplayer, and than refreshes page (with all inputs filled previously - so i got empty fields).
If I select "allow and remember", next time I start this code nothig is saved. I'm getting the same situation.
I found solution there:
How to enable Adobe Flash in FireFox Selenium webdriver with FirefoxProfile
If I replaced profile.setPreference("plugin.state.flash", 1); to profile.setPreference("plugin.state.flash", 2); it stopped to asking me if I want to enable flash player.
Here is the solution for you:
With Selenium 4.3.0, gecko driver v0.16.0 & Mozilla Firefox 53.0 this code works well with myfreecams.com.
It is worth mentioning that the default Firefox profile is not very automation friendly. When you want to run automation reliably on a Firefox browser it is advisable to make a separate profile. Automation profile should be light to load and have special proxy and other settings to run good test. You should be consistent with the profile you use on all development and test execution machines. If you used different profiles everywhere, the SSL certificates you accepted or the plug-ins you installed would be different and that would make the tests behave differently on the machines.
So, Create a New Firefox profile and use the same in the Test script involves three steps process. First you need to Start the Profile Manager, second is to Create a New Profile and third is to use the same profile in Test scripts. Let's assume we created a new FirefoxProfile by the name "debanjan".
Use the following code to open http://www.myfreecams.com/ with your new FirefoxProfile "debanjan":
String driverPath = "C:\\Utility\\BrowserDrivers\\";
//Mozila Firefox
System.setProperty("webdriver.gecko.driver", driverPath+"geckodriver.exe");
ProfilesIni profile = new ProfilesIni();
FirefoxProfile testprofile = profile.getProfile("debanjan");
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(FirefoxDriver.PROFILE, testprofile);
FirefoxDriver driver = new FirefoxDriver(dc);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.navigate().to("http://www.myfreecams.com/");
PS: This code is in Java so you may have to convert it into C# format.
Let me know, if this helps you.