I am developing a Browser Helper Object (BHO) for Internet Explorer written in C#. I use the BeforeNavigate event to get a called URL and save it into a local variable. For every tab a new BHO instance is spawned. This means that every tab has it's own BHO which in turn have own local variables. I have checked this by displaying a MessageBox with the previous called URL (the value of the local variable) before it is overwritten with the new URL.
string myUrl = "";
void BeforeNavigate( string URL, ... )
{
System.Windows.Forms.MessageBox.Show( myUrl );
myUrl = URL.ToString();
}
But in some cases the local variable is empty although a URL was called before. I investigated the IE settings and found out that this behavior is caused by the zone elevation protection of IE. For the zones local intranet and trusted sites the protected mode is disabled while it is enabled for zones internet and restricted sites.
E.g., when intranet.com is called and then internet.com in the same tab, I would expect that the MessageBox displays intranet.com when internet.com is called. But an empty string is displayed instead. I guess that calling internet.com activates the protected mode for this tab which spawns a new instance of the BHO. The MessageBox will now display the value of the variable of the new BHO instance. The value of the variable of the old BHO gets lost.
If protected mode is enabled for zones local intranet and trusted sites the BHO behaves correctly.
This issue I already described in IE's zone elevation protection interferences functionality of BHO to this point.
When I enable the EPM (Enhanced Protected Mode) the same problem occurs even if protected mode is enabled in all zones. Strangely also if I explicitly remove the tested URLs from the zones local intranet and trusted sites. (Note that "protected mode" and "enhanced protected mode" are different.)
In the context menu of a website the menu item properties gives information about the mode in which a website is executed. For websites in the internet the mode Internet | Protected Mode: Enhanced is displayed indicating that this website is executed in EPM.
I discovered that websites that belong to the intranet are executed in a "special" EPM. For an intranet website the mode Local Intranet | Protected Mode: Enhanced (122) is displayed. After I removed the tested URLs from the zones, Internet | Protected Mode: Enhanced (122) is displayed. I tried to find out what the 122 means but could not find any helpful information. It seems that calling a Internet | Protected Mode: Enhanced (122) website and then a Internet | Protected Mode: Enhanced website in the same tab triggers a boundary crossing which leads to the same issue.
Can anyone provide information about the meaning of the 122?
Any help will be appreciated, thanks!
In my opinion, it is just an inner serial number.
For more information about Enhanced Protected Mode, see the following Internet Explorer blog articles:
Enhanced Protected Mode
Understanding Enhanced Protected Mode
Related
I am trying to access a webpage (that is not under my control) namely allscripts sandbox via a WebBrowser control. My computer's internet explorer is correctly set up for said webpage (Added in Trusted Sites, Allowed and installed all active-x addons, running in compatibility mode, etc).
The webbrowser control displays the following error:
This webpage wants to run 'Some ActiveX control' which isn't compatible with Internet Explorer's enhanced security features. If you trust this site you can disable Enchanced Protected Mode for this site and allow the control to run.
I have not enabled (to the best of my knowledge) the enhanced protected mode.
Also trying to ignore the errors and continue with log-in displays a Message
The Centricity's container for .NET-based pages failed to initialize. Make sure your .NET environment is configured to grant Full Trust to this Website.
The above was also an error on the default IE until i run the command %WINDIR%\Microsoft.NET\Framework\v2.0.50727\caspol -q -m -cg Trusted_Zone FullTrust.
I have tried various registry keys but none seemed to work.
I have also tried implementing a custom IInternetSecurityManager that Maps all urls to zone Trusted and returns URLPOLICY_ALLOW on all ProcessUrlAction calls.
Any suggestion would be appreciated.
The problem could be that webbrowser uses by default an old version of the IE. Take a look at Use latest version of Internet Explorer in the webbrowser control
The webbrowser control is ie11 wrapped with a com wrapper that throttles back ie11 to ie7 mode. There's not a lot else going on there that I can imagine would cause your issue.
Since this page works for you when you run ie11 externally then the most likely explanation seems to be your attempt to force the control into ie11 mode is the problem.
I suggest you try Mentor's code here:
Set WPF webbrowser control to use IE10 mode
Which will automate adding the name of the running program to the registry.
var pricipal = new System.Security.Principal.WindowsPrincipal(
System.Security.Principal.WindowsIdentity.GetCurrent());
if(pricipal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)) {
RegistryKey registrybrowser = Registry.LocalMachine.OpenSubKey
(#"Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);
string myProgramName = Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location);
var currentValue = registrybrowser.GetValue(myProgramName);
if (currentValue == null || (int)currentValue != 0x00002af9)
registrybrowser.SetValue(myProgramName, 0x00002af9, RegistryValueKind.DWord);
}
else
this.Title += " ( Первый раз запускать с правами админа )";
I am developing a Browser Helper Object (BHO) for Internet Explorer written in C#. I use the BeforeNavigate event to get a called URL and save it into a local variable. For every tab a new BHO instance is spawned. This means that every tab has it's own BHO which in turn have own local variables. I have checked this by displaying a MessageBox with the previous called URL (the value of the local variable) before it is overwritten with the new URL.
string myUrl = "";
void BeforeNavigate( string URL, ... )
{
System.Windows.Forms.MessageBox.Show( myUrl );
myUrl = URL.ToString();
}
But in some cases the local variable is empty although a URL was called before. I investigated the IE settings and found out that this behavior is caused by the zone elevation protection of IE. For the zones local intranet and trusted sites the protected mode is disabled while it is enabled for zones internet and restricted sites.
E.g., when intranet.com is called and then internet.com in the same tab, I would expect that the MessageBox displays intranet.com when internet.com is called. But an empty string is displayed instead. I guess that calling internet.com activates the protected mode for this tab which spawns a new instance of the BHO. The MessageBox will now display the value of the variable of the new BHO instance. The value of the variable of the old BHO gets lost.
If protected mode is enabled for zones local intranet and trusted sites the BHO behaves correctly. I guess that the protected mode is disabled in this zones for compatibility reasons. There may exists websites in the intranet that do not work with protected mode. Thus, I am looking for a solution that works with protected mode disabled for this zones.
Since IE manages the loading of the BHO I doubt that this problem can be solved from within the BHO.
Does anybody have deeper knowledge about this topic to confirm my guess?
Is it possible to keep the variable's value with protected mode disabled for zones local intranet and trusted sites?
Any help will be appreciated, thanks!
I found the following link: http://jimevansmusic.blogspot.com/2012/08/youre-doing-it-wrong-protected-mode-and.html
There is said:
When you cross into or out of Protected Mode by, say, navigating from an internal intranet website to one on the internet, IE has to create a new process, because it can't change the Mandatory Integrity Control level of the existing process. Moreover, in IE versions after 7, it's not always obvious that a Protected Mode boundary has been crossed, since IE tries to present a better user experience by seamlessly merging the browser window of the new process with the already opened browser window. This under-the-covers process switching also means that any references pointing to IE's COM objects before the Protected Mode boundary crossing are left pointing to objects that are no longer used by IE after the boundary crossing.
Based on this, my guess seems to be right. The BHO which is a COM object of IE is no longer used and thus it's value gets lost. The only solution that remains is to enable or disable protected mode for all zones.
For some reason I seem unable to click a login button when using the selenium IEDriver. It works fine in both Chrome and Firefox.
Website is http://www.notacv.com/
Simple code...
IWebDriver driver = new InternetExplorerDriver();
driver.Navigate().GoToUrl("http://www.notacv.com");
IWebElement element2 = driver.FindElement(By.CssSelector("div.container-fluid.hero ul li:nth-child(1)"));
element2.Click();
I've tried the following to remedy the problem with no success
Have tried referencing both the li and the a tags
Both XPath and CSS selector - both confirm to find only one element via Chrome developer toolbar
Thread.sleep (prevents the error but does nothing when it gets to the click)
Repeating the click and the wait
Javascript, JQuery and angular waits
SendKeys(Keys.Enter)
actions -> moveto.Click()
Explicit wait to check displayed, visibility, enabled
Protractor for C#
Does anyone know how to fix this for IE?
please check the current link https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#Required_Configuration
Make sure you applied required changes
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 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.
What I'm trying to do is to, from a Web Service (WCF), give a remote computer (the Web Service Consumer) the instruction to open its default Web Browser (be it Internet Explorer, Firefox, Chrome, etc.), navigate to a certain web page and keep monitoring the events of that browser so that I can capture a certain value from the Document Title at a certain point, and do stuff with it.
I'm already able to send the command to open Internet Explorer and navigate to a URL, from the Web Service to the remote computer (my consumer), but I don't like the approach since I can't monitor the Document.Title property for changes nor access its value at any given time. Here is an example:
using System.Diagnostics;
public void DoIt();
{
Process batchProcess = new Process();
batchProcess.StartInfo.FileName = "iexplore.exe";
batchProcess.StartInfo.Arguments = "http://whatever.com";
batchProcess.Start();
}
This opens up Internet Explorer on the remote machine and navigates to the Url I give it, but I can't keep watch for the Browser's Events or Properties Values....
Can somebody help? ;-)
I don't think you can access information in one application (the web browser) from another (the WCF client) like that, and it's certainly not possible to do it without knowing what the user's default browser is.
You might have more luck using a WebBrowser control (WPF or Windows Forms), which embeds Internet Explorer's engine into the application and allows you access to the document title.
I'm using selenium but i m not able to use the IE browser when running tests using c#
The code i wrote
IWebDriver driver;
[TestFixtureSetUp]
public void setup()
{
driver = new InternetExplorerDriver(#"path of ie driver");
}
where i m doing wrong
Remove capability INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS and manually set your IE protected mode settings to be the same for all zones.
Source:
http://jimevansmusic.blogspot.com/2012/08/youre-doing-it-wrong-protected-mode-and.html
NoSuchElementException is occurred during implementation of InternetExplorerDriver in Selenium WebDriver
You need to configure the IE Security settings, more details on link https://code.google.com/p/selenium/wiki/InternetExplorerDriver
Also, another tip would be to use ONLY the 32-bit IEDriver (even on 64-bit machines) as the 64-bit driver is extremely slow.
Below is the extract:
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 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.