is there a way to open web browser in IE 11?
First, I checked the browser version that is 'microsoft edge' or not.
And then, if the browser is 'microsoft edge', I wanna open new window in IE 11 by using window.open.
Is it possible?
Here is a sample.
function checkVersion() {
//i wanna open new window in IE11.
//window.open('www.google.com');
}
Is there way to solve this problem?
Let me see if I am understanding correctly.
If someone is using Microsoft Edge, then you want to use JavaScript to open a new browser window in Internet Explorer 11. In other words, you want to switch browsers.
Is that right?
You will not be able to do this in MS Edge.
You would need to use something like Active X or Browser Helper Objects which are not part of MS Edge. Here is an example of you would have done it with ActiveX.
Related
I am trying the #longvh registry solution (Automating Edge Browser using VBA without downloading Selenium) and have a question: Do I need to change the VBA code to open Edge in IE Mode, rather than IE? If so, can anyone provide an example of that? Thanks!
Do I need to change the VBA code to open Edge in IE Mode, rather than IE?
There is no COM interface available for the Edge browser. Microsoft has not provided any way to automate the Edge browser using VBA automation.
So, there is no way to fetch the already opened instance of the Edge browser and retrieve elements with the help of VBA.
I work with Excel VBA Selenium under Windows 10.
I want to access a Chrome window that has previously been opened by another app and of whose name only the first part is known, the rest is a code that changes each time it is created. It is open together with other tabs in the active Chrome browser.
In order to start Chrome with Selenium, all I know to do is
Set dr = New ChromeDriver
This creates an Object "dr". When I look up the properties of dr, the property "Windows" shows the value
"BrowserNotStartedError / Browser not started. Call Get, Start or StartRemotely first."
Start or get both create a new Chrome instance which does not allow me to access windows in the already open instance.
I tried to use this code without "New", but this does not work.
I have not found any hint on how to work on the existing instance of Chrome. Is it possible at all?
If not, how else could I access any existing window? The URL is unique and can only be created by the 3rd party app for security reasons. If I try to copy the URL to the new Chrome instance I get an authentication error, so this is not an option.
This web page basically contains a menu that allows me to download certain data safely, which I want to automate.
Any help is appreciated.
Actually, there is a way to do it with Selenium driver for Chrome.
Locate your chrome.exe directory and copy and append the line below into the target bar.
--remote-debugging-port=9222 (Include the preceding space).
Then copy the following code into a vba module, execute it, and it will allow you to manipulate the existing chrome session that you created.
Dim chromeBrowser As Selenium.ChromeDriver
Sub existingChromeSession()
Set chromeBrowser = New Selenium.ChromeDriver
chromeBrowser.SetCapability "debuggerAddress", "localhost:9222"
chromebrowser.Get("https://www.google.com")
End Sub
My question has been resolved.
With a Selenium driver for Chrome, it is not possible to access Chrome tabs that have not been created with Selenium.
According to QHarr, it could be done by using shell/internet explorer to grab a handle on existing IE windows. In this case, of course, the app would have to create the HTML file with IE, i.e. the default browser would have to be IE.
I'm trying to make automated tests for a site, using Selenium IDE (not Selenium Server, RC, 2.0, and WebDriver).
I want to be logged in with user 1 in Firefox window 1 and open a Firefox private window to sign in with user 2. I need this because the website I want to test doesn't allow multiple users signed in in the same browser at the same time.
So:
1) Is there a way to open a private/incognito window?
2) How do I then switch back to the main window?
Here's how switching between simple windows looks like:
http://i.stack.imgur.com/P5bbt.png
In the attached image you can see how I solved the problem:
It works fine with Firefox version 42.0 (and earlier versions). With Firefox 43 I have some problems because "openWindow screen2" does not overwrite my window I open with javascript but opens an own window. I'm looking for a solution for this issue.
As far as I'm aware this isn't something that Selenium IDE can do. The best solution I can think of would be to use something like Autohotkey and combine the it with Selenium.
With AHK you can set a script to mimic the keyboard command to open a private window (ctrl+shift+p). When I've used it with selenium in the past I've set the AHK script to start when it detects a certain window title, and then had selenium call a javascript function from the user-extensions to amend the title of the page you're on to the title which will trigger the function when you need the AHK script to run. (Best not to use the default one, otherwise you could end up with countless private windows if it hits that page multiple times).
Try this,
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("browser.private.browsing.autostart",true);
In the console of the Developer Tools in Chrome, the 'focus' can be changed to an IFRAME using the dropdown selector, shown here:
How can that be done in Internet Explorer 11, in the F12 Developer Tools?
(I know that the contents of IFRAMEs can also be accessed using frames[0]....)
In IE from versions 9 onwards you can use the cd() command in the console to change the frame targeting you need to pass in a reference to the frame.
cd(window.frames[0])
To move focus to the top window, use:
cd()
and to move to the first iframe, use:
cd(frame[0])
Seems like you cannot use cd(top.frame[1]) to move to a sibling frame. But if iframes are nested, can use cd(frame[0]) to move into the first one, then cd(frame[0]) again to move in the nested one.
It is nice that immediately after typing cd(frame[x]) the console echos back: Current window: www.server.com/path/page.aspx showing you the current frame's source URL.
If I use IE I can visit the website I want and click the 'Next' button and life is good. If I open that same website using the webBrowser control and click the 'Next button I get a javascript error message.
I'm not doing anything in the code to manipulate the website. My goal, eventually, is to have some level of automation; but at this point, I get the javascript error and a pop-up and it screws everything else.
I can hide the JS error from popping up; by setting 'WebBrowser1.ScriptErrorsSuppressed = True' but the page isn't working because of the error.
The client script might be assuming a full browser is present and trying to access part of the browser outside the Document Object Model (DOM) of the page. For example, maybe the client script is trying to display something on the browser's status bar, or trying to modify a toolbar which isn't available in the WebBrowserControl. There could be numerous similar reasons.
If you do not have write-access to the web page in question to try fixing it, then play with WebBrowser Control properties such as ScriptErrorsSuppressed and ObjectForScripting
Try setting WebBrowser1 Silent property to true.
Actually, you are receiving this problem because when you run your site in IE8 or IE9 on your normal internet explorer desktop app, you are getting either IE8 or IE( rendering, depending on which you have installed. However, with the webbrowser control, unless you take the effort to change soem settings in the registry, the default rendering engine used by the webbrowser control is IE7 (if u have 7, 8 or 9 installed) and IE4 (if you have 4, 5 or 6 installed).
This is why you are having the problem, if you want help changing the rendering engine version for your webbrowser control, do a google search as there are many examples on SO, and i have provided this answer in some of my previous posts on this tag/topic. feel free to search or ask me.
Let me know how you go.