Testcafe which remote browser did my test run in? - testing

I use a custom browser provider - saucelabs - I'd like my custom reporter to know in which remote browser it ran so I can properly correlate the saucelabs video with a failed test.
This obviously is only an issue with concurrency > 1 :)
If a test fails which remote browser was it run in???
thanks!!
Mark

The reportTestDone method of a reporter plugin is called after a test is done in all browsers. If testRunInfo.errs array is empty, it means that the test passed in all browsers. If it is non-empty, every item has a userAgent property, telling in which browser the error occurred.
So, if you need a list of browsers in which the test fails, you could use something like this: _.chain(testRunInfo.errs).map('userAgent').uniq().value().
I didn't find this in the official documentation, though.

Related

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.

How to run TestCafe tests with throttling connection?

I need to check functionality if a file is uploading longer then 1 minute.
To check it with manual testing I use Chrome Dev Tools to set Throttling "Slow 3G".
But I can't figure out how to do it with TestCafe.
TestCafe does not have an API to set the throttling. However, TestCafe uses Chrome DevTools Protocol internally so you can get access to internal CDP methods.
Please refer to the following links to get started:
Chrome DevTools Protocol
chrome-remote-interface package
chrome-remote-interface repo
Please also take a look at the following example which shows how to enable file downloading in chrome headless.
I think you need to combine this example with the CDP Network.emulateNetworkConditions method.
Please refer to this article https://chromedevtools.github.io/devtools-protocol/tot/Network#method-emulateNetworkConditions

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.

What is the best way to test WebdriverIO "browser" object?

I started using WebdriverIO and noticed that the browser object it provides has a ton of methods, so I would like to play with it without having to run things from CLI.
Is it even possible to do something like open the page I want to run tests against on my browser and somehow use that object from the browsers console to see the results of the methods?
Thank you.
If you'd like to run JavaScript from within the browser, take a look at the 'execute' command.
There's also a full page of docs on the browser object for reference.

Is Phantomjs session isolation still not working?

When I run my selenium tests using a chrome browser all my tests cases run fine. When using the phantomjs browser it would appear that the browser session does not get reset after each test case. In my tests cases, I log in as a user to then navigate to certain pages and then logout. A problem occurs when a test case happens to fail. The browser session is not reset so when the next test case begins, the test that failed was unable to logout. This causes all test cases after a single failure to fail.
When searching the internet for a solution to this issue it been known sine 2013. I can't seem to find anything regarding this issue that's recent. Is there any up to date workarounds?
Manually trying to delete the cookies before or after each test case does not appear to work. webDriver.manage().deleteAllCookies();
I'm using phantomjs ver 2.1.1.
First of all PhantomJS is dead, you are better off switching to Headless Chrome or Headless Firefox.
Secondly PhantomJS is a port of Webkit which is not thread safe. This means that if you try and run more than one test in parallel you will see threading issues, to fix this you would need to start multiple instances of PhantomJS and have each GhostDriver instance connect to a different instance of PhantomJS.
The particular problem that you are seeing is that PhantomJS doesn't clear itself down properly, again the only solution would be to kill the initial PhantomJS instance you are running after your test finished and then start up a clean new one, unfortunately that is not supported by GhostDriver.
The final problem is that GhostDriver is dead as well, there was no point in continuing development when PhantomJS died.
TLDR; Use Chrome/Firefox Headless mode instead.