Recording Tests in TestCafe using PIV Card Technbology - testing

Using TestCafe, when running a test suite that already exists, and includes a signin function that clicks through and works successfully using PIV Card authentication and code that was written manually all works well. However, in the essence of speed, I was hoping to record tests using the TestCafe Studio software to get it done quicker than manually doing it.The issue we are running into, if I click "record a new test" on an existing test script, it attempts to run through the existing signin code, (which works if you run it as a normal test executing and not recording), it fails on logging in. I believe it's due to the nature of PIV. I was wondering, is it possible with testcafe studio, a setting perhaps that might maintain state of a logged in session rather than killing it at each test start? I'm already logged in with my PIV when I start the test, but it's appearing to log me out at the start of each session. Anyone have experience with this and know what I can do to make it remember me when I run a new test?

If I correctly understand your usage scenario, you are running tests using a user profile, which is already logged in. Unfortunately, TestCafe Studio does not have a mechanism for launching recording with profiles, as well as launching a browser with any options in general.
I can suggest you the following workaround:
Turn off the code responsible for the login when recording the script.
Use the await t.debug() function instead of login.
When the test starts, wait for the debug panel to appear in the browser and unlock the page:
Sign in manually.
Click Resume on the debug panel.
Write down your script.
Replace await t.debug() with a login function.

Related

Trouble getting Selenum automated testing to auto-login using my profile

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!

Aliexpress detecting automated browser, human verification fail in Selenium chrome driver

I want to write a script to scrap some data from aliexpress, so I need to be logged in first, When I try to login, Aliexpress ask for slide to verify sometimes, I made an script to do this in an automated way using selenium actions, but it gives the following error:
Screenshot of error
Well, I tried to it manually, But I am getting the same error, so it seems somehow aliexpress is detecting that its running in an automated environment, so please can you help me to avoid that.
Resources I used:
I used chrome_driver with brave browser and chrome but both didn't work.

Take over browser from selenium session

I'm not sure if there is a term for what I'm trying to do. I currently have a test suite using codeception for a php application. What I would like to do is be able to either of the following:
watch the browser automation in an actual browser
take over the browser at a specific point ( Sort of like a hand over from the script to the browser to allow me to continue to run a session )
Is this possible? If so what is it called in the selenium documentation
a) Selenium runs the actual browser and you can see what it is doing unless you configured Selenium to run some headless browser (but I don't know anything about headless browsers supported by Selenium);
b) Use Codeception's pauseExecution method to stop execution at specific point.
Documentation:
Pauses test execution in debug mode. To proceed test press “ENTER” in
console.
This method is useful while writing tests, since it allows you to
inspect the current page in the middle of a test case.

Saucelabs tests block on browser allow dialog

My web app uses IndexedDB and I'm testing on SauceLabs. Some months back my tests ran but now they block on a browser dialog that says "http://gbserver3.cs.unc.edu/" wants to: store files on this device", with an Allow button.
This is Win7 and Chrome or Firefox. Likely others too.
How can I dismiss or prevent this dialog?
Update: I have discovered that if I don't ask for quota I don't get the popup and my tests succeed. I'd still like to learn how to get rid of that dialog.
we are using Nightwatch.js in our project and we were facing the same issue.
What actually did the trick was using --unlimited-storage switch when launching the browser.
(List of other command line switches for Chromium can be found here)

Selenium / Protractor not able to run browser tests (E2E) if the user running it is not interactively logged-in

We have a Continuous Integration agent that runs with the identity of a non-logged-in user (non interactive) - i.e. the agent does work with sufficient Windows user credentials, but no user is "physically" logged-in to Windows and the agent run as a scheduled task with sufficient privileges.
The problem is that under these circumstances Selenium is not able to open a browser to actually run browser tests.
What could be the solution?
This guide just briefly mentions how to configure the Windows user to be able to run a browser with a non-logged-in user (using control userpasswords2) but that advice doesn't work.
To clarify, this problem is not specific to the Bamboo CI agent (referred to in the above link). It's common to all scenarios where Selenium running on behalf of a non-logged-in user would try to run a browser.
You need to have an interactive session to interact with. I believe this question on SuperUser Run interactive task even if user is not logged on Windows as well as the instructions from Atlassian you linked are the correct answer.
Once the user is set to auto-login, you need to reboot the system to cause that auto-login to occur. The recommendation in the linked question of forcing a lock after the login is a good one for security, but still provides an interactive session for the CI/Selenium to work against and without running under System with limitless privileges.
If this does not fix your problem after following all the directions and rebooting, and you have verified that the user is in-fact logged in at the time you run the CI/Selenium (typically you can check this with Remote Desktop and looking at that logged in user for the console session in Task Manager > Users tab), then there is most likely a different problem.