I am facing issue while launching my selenium script for edge browser.
I followed below steps-
Pre-Condition- I had Edge Legacy-Version 40 already installed on my system
1. Installed Edge Chromium Version LATEST-83...
2. Ran the automation selenide script on edge browser, it downloaded and used web driver version 83....
3. Our frameowrk is built like that it downloads the latest webDriver version at run time from github.bonagracia
4. Edge Legacy was replaced by Edge Chromium post installation and I could not access Edge Legacy
5. Due to some manual evaluation on my system, had to use Edge legacy so un-installed Microsoft Edge Chromium, but could not proceed ahead much, because there was some configuration change to be done at system level
6. Now, re-installed Microsoft edge chromium, but post re-installation I can access both Edge Legacy & Edge Chromium separately.
7. The automation scripts is now taking edge legacy-Version 40.... as the browser instead of edge chromium-Version 83.0.. & downloading this version from github.bonagracia.
Alternative-
Tried to disable the edge legacy in system properties, as cannot uninstall this software, because it is by default installed with Windows 10, but still that does not work. Selenide script is still downloading edge legacy web driver during runtime instead of edge chromium.
How can I ensure that my Edge legacy is disabled post installation of edge chromium and automation script uses the web driver manager for edge chromium rather than edge legacy.
Please suggest on this.
From your description, it seems that you will use the legacy version Edge and Microsoft Edge (Chromium version 83) version on the same machine. In this scenario, you could try to set the Edge driver directory path and the Edge browser's Binary Location when using selenium web driver.
To use the Legacy version Edge browser with Selenium web driver.
First, download the correct Microsoft WebDriver version.
Then, refer to the following code to assign the webDriver directory path.
// the edge driver directory path: MicrosoftWebDriver.exe
//var driverpath = #"C:\Windows\System32";
var driverpath = #"C:\Windows\SysWOW64";
//var driverpath = #"C:\Windows\WinSxS\wow64_microsoft-webdriver-server-components_31bf3856ad364e35_10.0.18362.1_none_cf827c8a6da82156";
//var driverpath = #"C:\Windows\WinSxS\amd64_microsoft-webdriver-server-components_31bf3856ad364e35_10.0.18362.1_none_c52dd23839475f5b";
using (var driver = new EdgeDriver(driverpath))
{
// Navigate to Bing
driver.Url = "https://www.bing.com/";
// Find the search box and query for webdriver
var element = driver.FindElementById("sb_form_q");
element.SendKeys("webdriver");
element.SendKeys(Keys.Enter);
driver.Quit();
}
To use the Microsoft Edge with Microsoft Edge webDriver.
First, download the correct Microsoft WebDriver version, then refer to the following code assign the Edge webDriver directory path the binary location.
#pragma warning disable IDE0017 // Simplify object initialization
EdgeOptions edgeOptions = new EdgeOptions();
edgeOptions.UseChromium = true;
#pragma warning restore IDE0017 // Simplify object initialization
edgeOptions.BinaryLocation = #"C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe";
var msedgedriverDir = #"E:\webdriver\edgedriver_win64_84_0_502\edgedriver_win64"; //msedgedriver.exe
var driver = new EdgeDriver(msedgedriverDir,edgeOptions);
driver.Navigate().GoToUrl("https://www.google.com");
Thread.Sleep(2000);
driver.Close();
[Note] Please remember to change the webdriver path and binary location to your owns. And in above sample, I'm using the C# selenium 4.0.0-alpha05 version.
Besides, here are some related articles might be is useful for you.
Access Microsoft Edge Legacy after installing the new version of Microsoft Edge
Use Microsoft Edge (Chromium) with WebDriver
Related
Due to end if IE life, I am replacing the WebBrowser (IE based) control in our native .net forms app (c#) to Microsoft.Web.WebView2.WinForms.WebView2.
The distribution page says, the user needs to install the WebView2 Runtime, which is about 100 MB!
My question, is this really needed? Isn't it enough to have the MS Edge installed (which is on EVERY Windows 10 machine)?
This page says:
Prerequisites: Ensure you install the following list of pre-requisites before proceeding. WebView2 Runtime or any Microsoft Edge Insider (preview) Channel (Beta, Dev, or Canary) installed on a supported OS (currently Windows 10, Windows 8.1, and Windows 7).
However, I am not sure if Edge Insider is a normal user's Edge Browser?
So, do I really need to distribute 100MB WebView2 Runtime (some of our customers are offline users) together with my App Installer (which uses WinForms.WebView2 control to display HTML pages inside my native App), or it's enough if MS Edge is installed on those systems?
The answer is: Yes, you need to install the WebView2 Runtime! The version of Edge installed on user's machines is NOT insider channel - it's the Stable channel.
Although you can use the Edge Insider channel, this is is not recommended except for developing, since only developers has this version.
To quote the page you linked to: "Microsoft Edge Stable channel isn't supported for WebView2".
Yes, you really need to distribute WebView2 Runtime. From the doc you link, you can find the reasons:
Under this paragraph Runtime or browser support during development or production, you can find that:
A production release of a WebView2 app can only use the WebView2 Runtime as the backing web platform, not Microsoft Edge.
The pre-installed browser on Windows 10 is Edge Stable Channel, most people won't install Edge Insider (preview) Channel, and:
Microsoft Edge Stable channel isn't supported for WebView2
Yes, include the WebView2 runtime in your distribution kit.
If you include the WebView2 Evergreen Bootstrapper in your kit, it will fetch the latest evergreen embedded browser. It's intended to be future-proof even if you don't update your kit for a while.
My kit installs correctly on W10, W7SP1, W8.1, WS2016, and WS2019 when I include the <2MiB bootstrapper and run it.
And, your installer can detect whether WebView2 is already installed, and skip reinstalling it. I hope everybody writing an installer will do that. If we do, then our users will be spared a reinstallation for each new WebView2-using app.
This little Inno Setup code stanza detects it correctly for me. Returns True when it's necessary to run the WebView2 installer.
function WebView2IsNotInstalled: Boolean;
var Pv: String;
var key64: String;
var key32: String;
begin
key64 := 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}';
key32 := 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}';
Result := True;
if RegQueryStringValue(HKEY_LOCAL_MACHINE, key64, 'pv', Pv) then
begin
Result := 0 = Length(pV);
end
else begin
if RegQueryStringValue(HKEY_LOCAL_MACHINE, key32, 'pv', Pv) then
begin
Result := 0 = Length(pV);
end;
end;
end;
(Please doublecheck this code: I am not an installer whizz.)
I am testing the WebView2 control and want to access local files instead of presenting a remote website. I am using the SetVirtualHostNameToFolderMapping method but get an exception specifying that the interface is not support maybe because an old version of the control or an old version of the runtime. I am using the most recent version of both (88.0.705.81 for the runtime and 1.0.790 for the WebView control) so not sure why I get the exception. Any help/ideas?
This is the line of code I get the exception on:
webView.CoreWebView2.SetVirtualHostNameToFolderMapping("web.example","web",CoreWebView2HostResourceAccessKind.Allow);
This is the exception I get:
An unhandled exception of type 'System.NotImplementedException' occurred in Microsoft.Web.WebView2.Core.dll
Unable to cast to Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_3.
This may happen if you are using an interface not supported by the version of the WebView2 Runtime you are using.
For instance, if you are using an experimental interface from an older SDK that has been modified or removed in a newer runtime.
Or, if you are using a public interface from a newer SDK that wasn't implemented in an older runtime.
SetVirtualHostNameToFolderMapping requires WebView2 Runtime version build 721 or newer. The feature is still in the prerelease SDK package and requires a recent canary channel Edge browser as your WebView2 Runtime.
Finding the version
You can see in the SetVirtualHostNameToFolderMapping docs the bottom of the page says it applies to SDK versions 1.0.721 and 1.0.790. And as the version doc notes, the WebView2 Runtime version that corresponds to an SDK version has a matching build number. So this new feature requires at least WebView2 Runtime version 89.0.721.0 or greater.
Prerelease vs release package
You are using the latest version of WebView2 Runtime which matches the stable channel of the Edge browser and the code for SetVirtualHostNameToFolderMapping hasn't made it to the stable channel yet. That's why its still only in our prerelease SDK package not the release SDK package. To try it out for now, you'll need to use the Edge browser canary channel as your WebView2 Runtime.
trying to run the Jmeter selenium script, it is launching IE11 browser with some port number and blank page, not able to go to the URL.
OS: windows7
Browser: IE11
if i run the same script in eclipse working with selenium and IE11 launching correctly.
WDS.sampleResult.sampleStart()
WDS.browser.get('http://jmeter-plugins.org')
WDS.sampleResult.sampleEnd()
Error in jmeter log:
JMeterThread: Test failed!
org.openqa.selenium.WebDriverException: session null does not exist (WARNING: The server did not provide any stacktrace information)
Internet Explorer 11 requires some additional configuration:
The IEDriverServer exectuable must be downloaded and placed in your PATH
On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
For Windows 10, you also need to set "Change the size of text, apps, and other items" to 100% in display settings.
For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.
So double check your configuration, if you are able to run your Selenium test using other client language - you should also be able to do it from JMeter.
If you still receive errors update your question with screenshots of the InternetExplorer Driver Config (all non-default settings) and full contents of your jmeter.log file.
I would also recommend checking out The WebDriver Sampler: Your Top 10 Questions Answered article for the most common queries explained.
I want to know How does Desired Capabilities in Selenium WebDriver works internally??
For e.g. Suppose i have 2 different version of Chromedriver.exe on my machine. While executing code with Desired Capabilities, which exe it would pick and why?
How does Desired Capabilities internally decides from which path exe should be picked??
The DesiredCapabilities Class is used by the WebDriver instance (i.e. driver) to open the browser session with specified attributes. For example, the below code will:
Always use the "chromedriver.exe" from "C:\your_path\" directory.
Through DesiredCapabilities Class we can specify the location of the Chrome Executable.
Finally you need to pass the instance of DesiredCapabilities for driver to open the Chrome Application with those capabilities.
System.setProperty("webdriver.chrome.driver", "C:\\your_path\\chromedriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.binary", "C:\\Program Files\\Google\\Chrome\\Application");
WebDriver driver = new ChromeDriver(capabilities);
driver.get("http:\\gmail.com");
It is always recommended to use the latest version of the drivers. The latest versions/releases of the drivers addresses the the bugs/defects of the previous build & also introduces new features. So, the idea of using another older version of drivers are not a part of good programming practice.
Let me know if this answers your question.
I am new to automated testing and, though my Selenium tests are running on Chrome and Firefox, they are not running on IE11. I did all the checks I detail below, but I keep on bumping into this error:
org.openqa.selenium.WebDriverException: Failed to navigate to http://myapp. This usually means that a call to the COM method IWebBrowser2::Navigate2() failed.
I did first the required configuration as in
https://code.google.com/p/selenium/wiki/InternetExplorerDriver#Required_Configuration) .
I have tried editing my registry as suggested at In IE: org.openqa.selenium.WebDriverException: This usually means that a call to the COM method IWebBrowser2::Navigate2() failed
to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE add a new DWORD value with the name iexplore.exe and the value 0, as described by https://stackoverflow.com/users/80779/lordofthepigs
I also tried introducing the piece of code suggested by https://stackoverflow.com/users/4210466/karunakar-sapogu :
new_window = self.driver.window_handles[1]
self.driver.switch_to_window(new_window)
But I seem not to be introducing it right because I got java errors.
Has anyone solved this problem in Java? Could you give me step by step instructions?
1) Are you sure that is your IEdriver instance run?
2) Did you use IEdriver x64 or IEDriver x86?
Even if you use x64 windows, in most cases you use internet exlporer x86. Please, try x86 driver and try to reproduce such behavior
It worked! Thanks so much. The problem was that I had the 64 bit version. By replacing it with a 32 bit version, my code worked (I have the driver in System32, to bypass modifying the path)
System.setProperty(webdriver.ie.driver", "C://Windows/System32/IEDriverServer.exe");
driver = new InternetExplorerDriver();
baseUrl = "http://mysite";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
This error message...
org.openqa.selenium.WebDriverException: Failed to navigate to http://myapp. This usually means that a call to the COM method IWebBrowser2::Navigate2() failed
...implies that the IEDriverServer was unable to initiate/spawn a new Browsing Context i.e. Internet Explorer Browser session as a COM object.
Required Configuration for Internet Explorer Driver
The Required Configuration of Internet Explorer Driver clearly mentions:
The IEDriverServer exectuable must be downloaded and placed in your PATH.
On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
Additionally, Enhanced Protected Mode must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
For Windows 10, you also need to set Change the size of text, apps, and other items to 100% in display settings.
For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates.
For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE.
For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE.
Note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Inside this key, create a DWORD value named iexplore.exe with the value of 0`.
Solution
First, you need to ensure that the Protected Mode settings for each zone to be the same value. Additionally you also need to ensure the Required Configuration for Internet Explorer Driver.
References
You can find a couple of relevant discussions in:
Internet Explorer Protective mode setting and Zoom levels
How does the registry entry HKEY_LOCAL_MACHINE\…\FEATURE_BFCACHE for InternetExplorerDriver solves the Internet Explorer 11 issue?
How to ignore zoom setting
Selenium InternetExplorerDriver doesn't get focus on the window
How to ignore protected Mode Settings for Internet Explorer using setCapability() through Selenium and Java?