I am trying to run some automation which uses Selenium 4 on Azure Virtual Desktop. As always with development - "it runs fine on my development machine" but on AVD the msedgedriver.exe launches a console window and states that "Microsoft Edge WebDriver was started successfully". However, then nothing happens, Edge browser does not launch and eventually my app times out and fails.
I absolutely have the right version of the webdriver which matches my version of the Edge browser.
I have tried adding the following arguments to my C# code: verbose, log-path=... but neither seems to make any difference.
Any suggestions on how I can increase diagnostics or what the issue might be?
Related
I'm using MS Edge browser (Version 109.0.1518.78) along with Selenium to do some automated UI testing with my corp environment.
Trouble is, the tests are always prompting challenging me to login.
Now here's the confusion: when i use Edge normally, the browser uses my profile settings to auto-authenticate me. However, when running the tests (via Visual Studio), an Edge browser instance is started WITHOUT my profile.
First thing I tried:
I have tried following various example without any success, such as this one from SO. Using this example i added these 2 arguments like this:
This didn't do anything. So I'm wondering if maybe the arguments have changed? The edge driver documentation is worthless when it comes to this.
Second thing I tried:
I tried creating edge driver service with arguments of my edge driver path.
Unfortunately, i get a driver initialization error saying something about "msedge.exe".
Summary
The summarize, my problem is that my selenium tests are starting an edge browser instance without my default corp profile. therefore i am forced to manually login, which is what i want to avoid.
Note that occassionally things will work fine as expected. Then suddenly the next day it reverts to this default behavior again. I am no sure what is going on!
I have developed a framework with selenium + .NET
I'm running all test using Bambo agent. Everything is working fine, except one thing.
As you know, chromedrive can not set window size bigger than actual machine screen resolution.
My bamboo machine has set 1920x1080 resolution. To make sure that it is for real 1920x1080, I wrote a powershell script that is executed on agent berofe tests and print out resolution. Btw I have bamboo agent with Windows
But when webdriver start browser (chrome, firefox or IE) it limits the browser window size to 1044x788. Looks like the webdriver is getting wrong resolution from bamboo agent.
As you know webdriver is not allowing to set bigger size of window than you actual machine has. Thats why we limit browser size to 1044x788
There is no way to change size of window for bigger one. Things like: Manage().Window.Maximize() or Manage().Window.Size = new Size (1920x1080) or starting chrome with webdriver adding some options for chrome like: chromeOptions.AddArgument("--window-size=1920,1080"); it is always limited to 1044x788.
Did any one have similiar problem? Can I somehow "hack" webdriver to open browser with 1920x1080? Meaby somebody knows how webdriver is checking the screen resolution? If he is looking for resolution in some windows file then meaby I could inject 1920x1080 resolution there?
Or meaby there is some setting in bamboo agent that I missed?
Why is that important? Becouse at same point I faced problem that on this smaller browser some webelements sometimes are overlaping (figure out that on screenshots) and it case some test to fail.
When I run test on my laptop it always have this 1920x1080 resolution.
P.S. I know about Selenium Grid but my aproach works great for me, until now :)
Before second I wrote another powershell script and create a screenshot on bamboo machine, and the screenshot has 1024x768 resolution. So meaby it is coused somehow by machine..
I know the answer. Bamboo runs all tasks as windows service (not as a user). That's why I was not able to see the browser and the screen resolution was wrong. There are two solutions:
Set up selenium grid hub and node on that one machine with your user, and paste url of hub in you framework. Then bamboo service will trigger selenium grid hub that is set by your 'user' and you will be able so see browser when you will log into the virtual machine and it wil have normal resolution (I have select this solution)
I think that there could be another solution to set up bamboo to run tasks not as windows service but as a user (not sure if it is possible).
I'm trying to run a different browser mode on IE with selenium using c#. Here's some code:
var ieWebDriver = new InternetExplorerDriver(#"PATHTOWEBDRIVER");
ieWebDriver.Keyboard.SendKeys(Keys.F12);
ieWebDriver.Keyboard.SendKeys(Keys.LeftAlt);
ieWebDriver.Keyboard.SendKeys("b");
ieWebDriver.Keyboard.SendKeys(Keys.NumberPad7);
I can open the developer tools (f12) but I'm not able to change the browser mode. Is IE preventing this due security? if so, are there any other ways to render content with a lower IE version?
thanks
No. The IEDriver is going to launch whatever IE is installed on the machine.
Changing the 'browser mode' is not a true representation of that version you are changing it to. IE9 on IE7 Standards Mode is not a true version of IE7.
Thus, you are stuck in a problem. You want to test different versions of IE, how do you do it?
The problem is that Windows let's you only have one IE version on a Windows PC at any one time. Yes, there are hacks and programs around to get multiple versions (IE5 and above) to run on a single machine, but they are hacks. Hacks which are not going to work all that well, and still, even with this, you wouldn't even be able to give the IEDriverServer the flexiblity to do this.
You will have to have seperate Windows machines.
A workaround, which again is a hack, is to set browser emulation mode in the registry, as documented in SO question.
Note that in the above question, the accepted answer is not going to work but the other answer may do. As note the comment on that answer, is by the maintainer of the IEDriver itself, advising strongly against this.
Another workaround, I have not tested, is perhaps use the native C# Keyboard.SendKeys, as documented here in MSDN. Am unsure if it will work (don't think anyone has ever ried it), but it is another option.
Selenium supports cross-browser testing of different versions of the same browser, but it is not achieved by switching the version in the Browser Mode in F12 Tools.
See https://code.google.com/p/selenium/wiki/Grid2
You can set up virtual machines with different versions of IE that work as Selenium nodes and use Selenium Hub to connect to them. Let's say you have a virtual machine with Windows 7 which has IE9 installed. You would start a Selenium node there and specify that it accepts requests for IE9 tests. You would then create InternetExplorerDriver for version 9, connect to the hub and run the test. The hub finds out the node with IE9 and runs the test there.
Related post here:
https://stackoverflow.com/a/8524216/1080590
This is of course different to what you're trying to do on a single machine, but it's more reliable and prevents you from extra management of your local IE instance.
We have Xserver-less CentOS system for continuous integration. So no UI.
I want to run selenium test cases on it. I am using new Alpha version of Selenium2 which has WebDriver integration. It starts and ends browser by its own. Now, How do I start that in background? Something similar is possible with Internet Explorer?
I am able to run correctly on local machine. But it opens Firefox UI.
Are you able to run a virtual frame buffer? That way, all the GUI programs can believe there's graphics happening, even if there's no actual screen. You may wish to search for the term "headless". One example.
Another possibility may be to use Celerity - a ruby-based "headless browser". It uses the Watir interface (originally a competitor to selenium), which I understand to be merging with webdriver.
I'm executing selenium tests with testng, that are started on a remote system with Selenium RC via hudson (with ssh connection). The remote system is windows xp with MKS Toolkit installed, hence ssh. Tests are NOT executed as a windows service.
I've tried using both captureScreenshot and captureEntirePageScreenshot methods. The first one always produces a black image. The second one creates the correct screen shot but it only works on Firefox and our tests usually pass on Firefox and fail in other browsers, so it is crucial to capture screen shots for the other browsers (mainly IE and Safari). The tests are ran in parallel, with many browser windows open at the same time. I'm not certain if this is what's causing the problem. Any thoughts will be appreciated.
Unfortunately screenshots in Selenium have been problematic from the start in browsers that are not Firefox. This is something that we Selenium Developers have been working on for a while to correct.
The latest work has been updating Snapsie to work in IE. There is a blog post at http://blog.codecentric.de/en/2010/02/remote-screenshots-mit-selenium-und-dem-robot-framework/ that explains what has happened.
I have noticed that if the screen isn't active, i.e. the screensaver has kicked in, it can produce black screenshots.
Edit:
I just had a thought. You can always run Castro to video record your tests and then watch it play back. This is something SauceLabs use to run Selenium in the cloud.
Write a method for this and call that whereever you need to take the screenshot. Use the java.awt package which has been used in selenium. For example, check this site
After setting Windows Auto-Logon, and launching process not as Windows Service, I found how to solve the Remote Desktop with Black Screenshots problem of IEDriverServer.exe, by creating a batch file that disconnects RDP, instead of closing the RDP session with the regular X button:
%windir%\system32\tscon.exe %SESSIONNAME% /dest:console
See more details here:
https://stackoverflow.com/a/24529629/658497
(Although, I would prefer there was a way to run it as the default action, when terminating RDP session with X Windows button).