I have Playwright running inside WSL2 on Windows 10. WSL is configured to work with GUI apps. Opening browsers is fine, but when starting with Playwright Inspector
# npx playwright codegen google.de -b wk --viewport-size "1024,768"
the inspector window remains empty, see right side of the screenshot below.
Again, Playwright itself works fine. It is only Inspector I have trouble with. How to get Playwright Inspector working in WSL2?
> wsl --version
WSL-Version: 1.0.3.0
Kernelversion: 5.15.79.1
WSLg-Version: 1.0.47
MSRDC-Version: 1.2.3575
Direct3D-Version: 1.606.4
DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows Version: 10.0.19044.2486
Related
I'm attempting to execute a TestCafe suite on locally installed Safari. I have previously executed the tests on chrome, chrome:headless, firefox, and firefox:headless. When running the command testcafe --list-browsers to retrieve my list of installed browsers, I receive the following:
testcafe --list-browsers
Using locally installed version of TestCafe.
firefox
chrome
safari
When I execute a simple test via command line, testcafe safari path/to/tests/, the Safari browser will launch, but no navigation takes place. I remain on the launch window (showing my favorites and recently visited pages).
When the same command is executed for a different browser (say, testcafe chrome path/to/tests/), the tests are executed in the local browser.
Am I missing something that is required to get Safari up and running with TestCafe? I'm using TestCafe version 1.6.1. I'm not seeing any additional setup mentioned on the TestCafe documentation...
I was able to resolve this issue by disabling all uses of TestCafe Browser Tools in System Preferences -> Security & Privacy -> Privacy -> Automation. On my subsequent execution, I was prompted to allow TestCafe Browser Tools for Safari. After accepting the prompt, the tests ran as expected.
I also had deleted my node_modules directory and reinstalled dependencies, although I'm skeptical if that helped.
Background
I am tasked with replacing our IE based printing logic with Chromium so that we can eventually support running our current server software on Windows Server Core or potentially other operating systems that support .Net Core. My current thought is to either use Chromium embedded framework or to make use of Puppeteer. I am leaning towards the later because I feel it would be easier to port between operating systems.
Issue
Originally it failed to start with an error about sandboxing so I added the no-sandbox flag. Now when I try to load Chromium it fails to start with the exception below stating that it cannot load chrome.dll
PS C:\Program Files (x86)\Google\Chrome\Application>> .\chrome --headless --enable-logging --disable-gpu --screenshot="C:\screen.png" "https://www.chromestatus.com/"
Which yields the following error in the debug.log file:
[0813/133208.016:ERROR:main_dll_loader_win.cc(134)] Failed to load Chrome DLL from c:\Program Files (x86)\Google\Chrome\Application\68.0.3440.106\chrome.dll: The specified module could not be found. (0x7E)
I have checked around the internet and found a few mentions of this error but the suggested fixes don't seem to fix the issue.
I was able to download Chromium 72.0.3592.0 via Chocolatey and the issue is resolved in that version. I tested using Server Core 2016 LTSB.
choco install chromium --pre -y
chrome --headless --disable-gpu --dump-dom --enable-logging https://www.chromestatus.com/ --no-first-run
Edit:
If you are attempting to run Selenium Tests using Docker windowsservercore and chromium: The command line tests of chromium chrome.exe appear to never work from the container command line.
However when you run dotnet test app.csproj or dotnet vstest app.dll inside the container the webdriver successfully starts and drives the browser
This has been reported to the Chromium team. It appears that Chromium 68+ might have issues with Windows Server 2016.
https://bugs.chromium.org/p/chromium/issues/detail?id=873097
When running tests, I would like not to be bothered by Chrome popping-up every time Behat launches a scenario needing Chrome.
I know there is a maximizeWindow() method for session objects, but nothing like "minimize".
Nowadays, you can set Chrome to run in headless mode like so (behat.yml):
default:
extensions:
Behat\MinkExtension:
javascript_session: browser
sessions:
browser:
selenium2:
browser: chrome
capabilities:
chrome:
switches:
- "--headless"
You could run Chrome with a virtual framebuffer, so that the window appears on a virtual screen instead of your real screen.
This also allows to easily run your tests on a headless machine, such as a build server.
On Linux, we're using xvfb for this particular purpose. More info: How To Run Your Tests Headlessly with Xvfb
For Windows, see Is there anything like xvfb or xnest for Windows?
Seems there is no method for launching in background. maximizeWindow is for setting the resolution.
You should try to run in a virtual machine or on another PC in order to avoid this kind of issues, popups and interacting by mistake with the window that runs automation.
Running on the same machine should be done when writing new tests and when debugging.
I found an acceptable solution for this that didn't require me to run Chrome headless or in a virtual machine.
Simply log in with a secondary user account on your local machine, and run selenium on that account. Then, switch back to your main user account and run your tests. The chrome browser will be created under the user running selenium and you will never see the chrome windows pop up.
I am currently working in Automation QA. Our project using Java: jbehave, thucydides, selenium. We are working in Ubuntu OS.
Every time I run my tests, I have to stop doing everything(coding, browsing the web), because every click or any action of selenium is taking driver window(we are using chrome driver) in focus(makes window active) and if i do something i mess up the test. Our team is wasting a lot of time because of this.
We have tried Phantomjs, it doesn't work correctly, cannot find elements etc... And also to run tests in virtual machine using vagrant isn't working for us(for company specific reasons).
It is fine if Chrome driver will take over active window when it starts, as long as it would continue performing different actions in background. Strange, but in my previous project(windows, c#, mstest) chromedriver would behave exactly like this without any additional setup.
Please help, I know few other teams having this issue. Seems like this issue only on Mac and linux.
After having this issue for a long time I have finally found a good solution. This issue still remains on ChromeDriver level, so if there are any updates on this side let me know.
The easiest way to run tests in Ubuntu in a background is using VNC Server. Here are the steps you should follow:
Install vnc server from ubuntu terminal:
sudo apt-get install vnc4server
Start server with any number(I use 7). First time doing it enter password for vnc server(Remember it!).
vncserver :7
To start server in full screen add "geometry" to last command with your screen resolution for example:
vncserver :7 -geometry 1920x1080
Download some VNC Viewer. I use Real VNC.
Go to Real vnc viewer, start new connection and enter:
VNC Server: localhost:7
Encryption: Let VNC Server choose
Press connect and enter your vnc server password(the one from step 2).
New window should be opened, open new terminal in it.
Run your test from terminal. I use java maven project so for me it works like this. Navigate to project folder and run: mvn clean install
If you want simply to run test in hidden mode using only terminal(without opening vncviewer) use this command:
cd path/to/project
xterm -display localhost:7 -e mvn clean install
If you want to stop server:
vncserver -kill :7
Hope this will help many of you.
For me (I had the same problem in my Grails project's functional test using Chrome; not with Firefox) works this set up:
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized --disable-popup-blocking");
new ChromeDriver(options);
Regards
I am new to Appium. I started using the Appium app, added the simulator app file and lunched the simulator (using "launch"), as described here
I also succeed recording a test on my app and got the Ruby output (is there an PHPUnit option?).
I cannot find any good knowledge base of how can I run/use this test now? (supposed I have already created / recorded a test)
Note: the only close thing I found is this:
bundle exec cucumber features/plain_note.feature
But it uses cucumber. How can I run a simple test just recorder in the inspector?
Here's how to run your Appium Inspector saved ruby boilerplate tests.
1) Start the Appium server in terminal with this, and leave this terminal window open.
$ appium &
2) While the appium server is running in the previous terminal window, open a new terminal window and navigate to the directory where your tests are located and run them with this.
$ ruby "your_test.rb"
That should execute your Appium test you recorded with the Appium inspector.
If you have the Appium GUI running/open, you may have node issues about the same port already in use. If this happens simply run this in terminal.
$ killall node
If you don't already have the appium server installed you can install it by running this in terminal which requires npm to be installed.
$ npm install -g appium
Hope this helps.