Chrome Browser window closes automatically after test run - google-chrome

I am developing coded ui tests(Using VS2012 Premium, Update 4) for my application. I have initially recorded my tests using IE8 and it works fine in in IE8. But When I try to run these tests in Chrome, the browser window automatically closes after the first test run and rest of the test fails. I am using the following code to launch chrome browser window
BrowserWindow.CurrentBrowser = "Chrome";
BrowserWindow window = BrowserWindow.Launch(new Uri(url));
window.CloseOnPlaybackCleanup = false;
The same test methods run in IE8 without any error, but in Chrome the browser window closes automatically. If I run a single method it runs and closes window after the test run. I have verified other threads also, but nothing helped me to solve the issue.
I have already downloaded the selenium components required. Please let me know if anyone has faced this issue
I have tried to put the code in TestInitialize method but the result is same. Then I tried launching the browser using the Procees.Start method. This launches the browser but Coded UI is not able to find the browser window and it fails.

The solution that refers to my blogpost will not work. This is a known limitation of codedUI cross browser functionality. Reuse of browser window cross test methods is only supported on IE
It is documented here:Introducing cross browser testing
hope this helps,
Marcel

Related

Chrome "--headless=new" mode does not allow to apply "--window-size" option

When new chrome headless mode is used the "--windows-size=width,height" argument doesn't work.
For example:
"--headless=new",
"--window-size=1920,1080"
Running tests with these arguments produces strange size screenshots: 1028x653 px
But with the old headless mode:
"--headless",
"--window-size=1920,1080"
the screenshots size is OK: 1920x1080 px.
I can't use old mode, because the files downloading is not working in it anymore, here is the post about it, where using the new headless mode is suggest as a solution: Downloading with chrome headless and selenium
Are you running your tests with a CI-Tool like Jenkins?
I see a similar behavior (messing up the screen size) only with a central run on Jenkins, like always..local it works.
If so I think it has to do with the system user the test is executed through a jenkins agent.
This is a bug being fixed in Chrome. You can see the status of the fix and the reasons here:
https://bugs.chromium.org/p/chromium/issues/detail?id=1416398

Chrome/Selenium: use-file-for-fake-video-capture not working anymore

I have automated ui-tests that test a web application in chrome using https://theintern.io/
The application offers a barcode scanner using the device camera (https://github.com/zxing/zxing).
To test this feature, a fake barcode is shown to the application, this has worked until chrome version 90/91 (not quite sure anymore).
Since this version I can not access the fake video anymore.
Chrome-options I have set:
use-fake-device-for-media-stream
use-fake-ui-for-media-stream
`use-file-for-fake-video-capture=${fakeVideoFilePath}`
I can reproduce this outside of the application if I use the chrome window configured with selenium and go to
https://webcamtests.com/
This loads forever - same thing happens inside the application.
The webcam name is the path to the video the camera is supposed to show.
Any hints on what is causing this problem or how it can be solved?
Thanks!
Fixed with Chrome 93.
After the update it is just working again.

Can programs be written that can quit from Chrome browser?

If I visit a site, I want to close the Chrome Web Browser. Is it possible to write such a program?
Under normal operation, this should not be possible. However, there have been cases where browsers have had well known bugs that could be exploited. To be clear though, I'm referring to crashing the browser. There is no supported API or method of asking the browser to close.
For instance, a simple line of CSS could crash Internet Explorer 6. Something like this on Chrome would probably not work anyways, since Chrome runs each tab in its own process.
There is a way to close a browser window (tab) via script if your script opened the window, simply by calling window.close() (where window is the child window). Please see https://developer.mozilla.org/en-US/docs/Web/API/Window/close for more information.

Issues faced while Using Chrome Headless Browser in testing

The Chrome Headless browser was unable to identify the element even it is mentioned with an id in the test case. While running the same test case in chrome browser,
it was working perfectly fine and was failing when I try to run the test case using Chrome Headless Browser. I have set the window size for the chrome headless Browser even the results were same.
Unable to find the element located by ‘By.xpath: //input[#id =
‘tipo_meta-display_name’]’. Please recheck the objects properties to
make sure the desired element is located.
Can anyone help me with the issue

Chrome settings - set "emulate touch events" as default settings

We are trying to run some automated tests (coded ui based) on our mobile application via Chrome browser.
In order to make the tests available to run, we must set the browser to work as 'emulate touch events'.
The thing is that as part of our test flow, a new chrome browser is being launched on each test but the definition is gone.
I already check this one, but it doesn't work:
How to Always Emulate Touch Events in Chrome Dev Tools?
Any other suggestions?
Thanks,
Yair
I believe that the dev tools window must be opened for the overrides to kick in, have you tried that?