Error::SessionNotCreatedError: Unexpected error launching Internet Explorer - ruby

Unable launch Internet Explorer using my script it gives this error
Selenium::WebDriver::Error::SessionNotCreatedError: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones.
I researched a lot to get work around for this and found few solutions https://stackoverflow.com/a/29453294/1976848, but I am unable to change my IE browser settings, The checkbox to "Enable Protected mode" is disabled for all the zones here
Also, tried to override this with desired capabilities here is the code but not getting any success:
caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer(
:ignoreProtectedModeSettings => true,
:javascriptEnabled => true,
)
Watir::Browser.new :ie, http_client: client,:desired_capabilities => caps
I am using Cucumber with Ruby and Watir and Browser is Internet Explorer 11.
Please suggest some workaround for this.

The issue gets resolved after doing continuous research around it,
Most of the Stackoverflow and Github answers shows to change the settings from Internet Options but those are not working from me due to permission limitation
One of the blog posts from LinkedIn https://www.linkedin.com/pulse/automation-using-internet-explorer-11-pritam-maske. Suggested to modify the registry specific to internet explorer, but that too I am unable to edit due to permission limitations.
Taking the points from registry modification, then I found a way to edit it via PowerShell script and found few solutions to reset the Internet Explorer Preferences from Microsoft power shell script repositories
How to reset all Internet Explorer settings for a different user profile?
With this got 1 step success but main problem remains same i.e. my IE 11 not launched, then searched for to "Enable the Protected Mode for all Zones" and got few post with a good description around it
a. Powershell – IE zones Protected Mode state
b. IE Browser - Powershell script to add a site to trusted sites list, disable protected mode & make all zones security level low
At last, after doing tweaks in the Powershell script it works and my script is working fine for IE browser.

Related

How to disable "file risk warning prompt" in windows 7?

I'm trying to edit a document from an alfresco repository using MS word via the AOS module. Unfortunately I get a warning prompt about this all the time.
The message in the prompt reads to this effect:
Some files can harm the computer. If the file information below looks
suspicious or if you do not fully trust the source, then do not open
the file.
I have so far used inetcpl to configure the trusted sites for the intranet zones and added the domains to the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains
following the instructions from this site and some others (which all practically allude to the same thing) but so far I have had zero success in disabling the thing.
OS: windows 7
EDCM: Alfresco 5.2 with AOS
Browser: Internet Explorer 11
Your error message is not in English language, So it is difficult for us to understand which actual error you are getting.
If you are trying to open file via IE and getting security warning for opening a file then you can refer steps below to stop it.
(1) Open Internet Explorer.
(2) Go to Tools.
(3) Click on Internet Options.
(4) Select Security tab.
(5) Click button named as 'Custom level'.
(6) Find an option called 'Launching applications and unsafe files(not secure)'.
(7) Enable it.
(8) Restart the Internet Explorer.
Note: It is not recommended to enable this option for a security reason. You can try to make a test with it to check whether it can solve your issue or not.

VS Express 2013 for Web - Browser is security restricted or JavaScript is disabled

I initially installed the Microsoft Visual Studio Express 2013 for Web on my desktop. My desktop runs Windows 8.1 with internet explorer 11. It ran fine until the license expired after the first 30 days. I tried to sign in to renew the license, however after clicking the 'sign in' button I get an error dialog. The dialog states 'Browser is security restricted or javaScript is disabled. I have no other option but to close and exit Visual Studio.
I went to the online forums for Microsoft. There were discussions and suggestions on how to fix the error. I tried lowering the settings for the security tab in internet explorer. I have validated the option for scripting is enabled. I have also added https://*.visualstudio.com to the trusted sites tab. Other users on the forum have tried the same suggestions and have not succeeded in signing into the visual studio application.
I had exactly the same problem, here is what I did:
a) Go in IE, click on settings wheel then Internet Options and Security tab.
b) Click on Custom level button (make sure you select Internet zone).
c) In Security Settings window, under Scripting I set Enabled for Active scripting.
After that Sign In should work. Even though Chrome is default browser, it seems that VS uses IE for sign in process.
Hope this helps!
There is another issue people are running into that is a bug with the login dialog. The login dialog is using a Web Browser control to login the user. By default it loads up "about:blank" as the URI. It then proceeds to try to execute some JavaScript (just ";") to verify it has permissions to do so. On some machines this is problematic because "about:blank" has been mapped to zone 0, or the Local Machine zone. When the JavaScript is executed MSHTML will check the zone of the URI and then the policy for executing scripts. By default the Local Machine zone is locked down, and all script executions result in a Query policy. What this means is if you're running in immersion mode (aka in Internet Explorer) you will get a message box asking if you want to execute the script. However, the Web Browser control used by VS 2013's "Sign In" dialog doesn't run MSHTML code in immersion mode, so the Query policy effectively equates to a Disallow policy. The bug here is someone in VS assumed "about:blank" resolves to the Internet zone, and when it resolves to the Local Computer zone you get this behavior.
The workaround is to remove "about:blank" zone mapping. Point regedit to this key:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains]
Remove the "blank" key.
Alternatively you can change the Local Machine Lockdown policy for executing scripts. The reg key for that is:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Lockdown_Zones\0]
Set the "1400" DWORD value to 0.
There are many sites you need to list in your Trusted Sites. Following the trace of what the stupid, stupid login script does:
https://.visualstudio.com
https://app.vssps.visualstudio.com
https://.accesscontrol.windows.net
https://auth.gfx.ms
https://login.live.com
Only then was I able to log on to my FREE software.
Hi this is Albert from Microsoft. Just want to let you all know that this issue has been fixed in the upcoming Update 2 for Visual Studio 2013. Thanks for your patience while we figured this one out :)
Same problem "Browser is security restricted or JavaScript is disabled" here but the solution from #jic didn't work for me..
If you can and it is convenient for you this is a solution which worked for me:
I have created a new user/profile on my PC and for this user it was just working fine.
Before this action I have tried to make an user account which had this problem as:
Power user - didn't work
Administrator - didn't work as well
So the last solution in my case was a brand new user on the PC..
Here's what worked for me.
Open Control Panel, Internet Options.
First, I clicked the Security tab and turned security the security for the Internet zone to its minimum.
Next, click the Privacy tab, then click Advanced. Choose "Accept" for both types of cookies.
Of course you can change these all back after extending your VS trial.
you must change secure settings of iexplore for admin account. If logon by other account, you must start iexplore under admin account or logon under admin account, because you will get license after admin account.
Click on Start --> Run --> type cmd and click on OK.
Command Prompt will be opened. Then enter this command.
ipconfig /flushdns
and press Enter.
Now try to access https://app.vssps.visualstudio.com/Profile/View
It worked for me...
As I can not add a comment yet to the answer of CBGraham, I've to add this note over here:
The solution described from CBGraham worked for me (Thanks Graham). I had to add an additional link:
https://account.live.com
Then I opened the IE and tried to login to a Microsoft site. I left the IE window open and just clicked once again on the VS to login. Then it worked for me. Even with strong restrictions on the IE settings. While I'm surprised why someone should set down his security settings, just to register VS.

Watir, Automation on Windows 7 with IE8

I am trying to run watir scripts on Wndows 7 on IE8 as administrator.
Here is problem description:
Problem was with below statement(popup windows)
popup = Watir::IE.attach(:url, /ContactDetails/)
and Error message was Unable to locate the url(ContactDetails)
The issue seems to be that when there already exists an instance of IE8 that was opened with administrative privs, Watir won't see any other IE8 windows that are being run as admin, including ones it opens itself.
Fix that i have been doing:
Turn off User Account Control (set to the lowest setting). Go to Control Panel->System and Security->Action Center->Change User Account Control settings, and drop the slider to the lowest setting.
But this is not a permanent fix, i have to change the windows 7 settings every day to run my automation script.
Can anyone help me finding out the permanent solution ?
As far as I know, watir-webdriver does not have IE class and attach method.
Have you tried to attach via the title of the page? for example:
browser2 = Watir::IE.attach(:title, "Google")
if the browser you wanted to attach to was Googles home page.
Look at the source code and
put whatevers inbetween the title tags on your page.
Google

Win7 Google Chrome caching Internet Connection Settings

I have some code that runs in a Windows service and sets some proxy settings on a per-user basis. Specifically it sets:
HKU[user sid]\Software\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL
HKU[user sid]\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\EnableAutoProxyResultCache
HKU[user sid]\Software\Policies\Microsoft\Internet Explorer\Control Panel\Connection Settings
For "locked down" users it sets:
AutoConfigURL=http://127.0.0.1:8888/wpad.dat
EnableAutoProxyResultCache=0
Connection Settings=1
For "unlocked" users it sets:
AutoConfigURL (deletes this key)
Connection Settings (deletes this key)
Everything works great on Windows XP, in IE, FireFox, and Chrome. As soon as I restart any of those browsers, the new settings are used (uses the proxy or doesn't).
On Windows 7, everything works great in FireFox and IE, but not Chrome. Chrome doesn't start using the new settings until one of the following happen:
I run inetcpl.cpl and click the OK button (don't need to change anything, but do need to click OK, not just Cancel)
I log-off and back on the Windows user account
I run IE (just running IE and closing it)
I'm looking for a programatic way to reset this cache, whatever cache it is.
What I've tried but hasn't worked:
Almost every "netsh" command option I can think of.
InternetSetOption() (see MSDN) with the proxy settings changed and refresh flags (using NULL as the hInternet handle)
Deleted the values under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\
Has anyone seen this caching issue and found a way to clear it? If not, what info should I be looking for in general. Is this a WinHTTP cache, TCP, IP, WinInet? Even though it is only showing up in Google Chrome, I don't think it is an actual Chrome cache, I think it is at the OS level.
I know I should probably be using InternetSetOption instead of updating the registry directly, but that doesn't work from a service, and I've found some anti-virus programs that are causing issues with any desktop app level code (but they don't mind if my service updates things). Not to mention that some of the settings above require admin/elevation to modify, even though all under HKCU.
Appears to be a testing error, or an anomaly, calling this after setting the registry values does appear to work:
InternetSetOption(NULL,INTERNET_OPTION_SETTINGS_CHANGED,NULL,0);
InternetSetOption(NULL,INTERNET_OPTION_REFRESH,NULL,0);

How to disable IE8 script error message?

I'm using CodedUI on IE8, and get this error message:
Stop running this script?
A script on this page is causing your web browser to run slowly.
If it continues to run, your computer might become unresponsive.
I've read some forums and did the following: Tools > Internet Options > Advanced tab > Browsing
Check the "Disable script debugging (Internet Explorer) checkbox
Check the "Disable script debugging (Other) checkbox
Uncheck the "Display a notification about every script error" checkbox
and this message still appears...
Can anyone assist me here?
IE has a registry setting for that
Error message: "A script on this page is causing Internet Explorer to run slowly"
but that requires you so change the registry on each client machine and for each user.
It will however allow you script to run so you can profile it and find out whats causing the delay.
Also look at this SO question How to mimic effects of MaxScriptStatements (i.e. prevent “A script on this page is causing Internet Explorer to run slowly”) without changing the registry?

Resources