creating selenium tests on chromeOS - selenium-chromedriver

I currently have a java project which instantiates various browsers via selenium hub/node on various windows operating systems. Is there much involved to expand this to cater for running up a browser on a stock chromebook chromeOS?

The following are steps I tried back in November 2014. The result was unsuccessful and I opened a question on the Google forum with no response.
followed manufacturer's instructions to put the Chromebook in Developer Mode
set chromeos-firrmwareupdate to dev mode and removed rootfs verification from partitions 2 and 4
downloaded and installed Java (latest jre), required for Jenkins slave and Selenium
downloaded Jenkins slave.jar and selenium-server-standalone.jar (2.41.0)
put Jenkins and Selenium in /home and remounted to remove noexec
remounted tmp to resize to 2G (req for Jenkins)
added DISPLAY=:0.0 to ui.conf to set display
added chain rule to allow tcp input
added 'no-sandbox' and 'disable-setuid-sandbox' switches and excluded 'test-type' switch
Result: ChromeDriver started up, opened up a gray screen (a broken instance of Chrome), and closed with an "unable to open pages" error. Weird thing, though, was that the same command used to launch Chrome worked when run from the terminal.

Related

Chrome nativeMessaging example fails on Windows

I downloaded the official Chrome nativeMessaging example to test it out.
To do this, I installed the app from chrome://extensions, by choosing Load Unpacked. No problems so far.
I then installed the host. I'm using Windows 7, so I ran install_host.bat, which claimed that "The operation completed successfully." However, when I go to chrome://apps/ and click the Connect button, I get this error:
Failed to connect: Native host has exited.
Is there some reason this would happen? Restarting Chrome did not fix the issue, nor did uninstalling and then reinstalling the host program.
(I noticed that native-messaging-example-host.bat requires Python 2, so I modified it to run Python 2 explicitly. If I run native-messaging-example-host.bat from the command line, it pops up a little example program of its own with a GUI and seems to work correctly.)
Turns out I was using a non-standard character in the path leading to the host executable. This wouldn't be a problem for any other program, but Chrome's native messaging API doesn't like it, I guess.
By the way, the documentation on setting up this example is near-nonexistent, but this stack overflow link has some useful info: Chrome Extension NativeMessaging 'connectNative' undefined

IE not connected by Karma Runner using VSTS Gulp task

I am facing an issue with my build pipeline using VSTS.
Environment details are:
Agent server is Windows Server 2012 R2
The VSTS agent is running on network service
For running my client side test cases, I have created a gulp task. Karma runner is used with IE as the browser launcher.
The issue I am facing here is with IE as browser in karma.conf file. Whenever this gulp task is ran using VSTS then the karma runner is not connecting. The output is:
[33m20 09 2018 17:32:43.924:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (1 times)
2018-09-20T12:02:43.9339866Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:02:43.9342689Z Disconnectedundefined
2018-09-20T12:04:14.1287942Z [33m20 09 2018 17:34:14.125:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (2 times)
2018-09-20T12:04:14.1289323Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:04:14.1299244Z Disconnectedundefined
2018-09-20T12:05:43.7605115Z [33m20 09 2018 17:35:43.758:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (3 times)
2018-09-20T12:05:43.7635052Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:05:43.7641486Z Disconnectedundefined
2018-09-20T12:07:13.2066049Z [33m20 09 2018 17:37:13.205:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (4 times)
2018-09-20T12:07:13.2110144Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:07:13.2112337Z Disconnectedundefined
This same task works fine if the browser is set to GoogleChrome only. In case it is set either to IE only or GoogleChrome and IE then this task is not working. Also, if I run this task manually through cmd, then it is working fine.
Is there some issue with the VSTS agent service running account?
I think the problem is that IE (and Edge for that matter) can't be run under a service account - they have to be run in an environment which has an interactive desktop session.
The hack I used in the the question you linked to was to logon to the build agent using the Team City agent account and then manually start IE. This allowed me to accept that annoying first run dialog it has, and for it to layout what ever files it needs in the user profile folder to run. I would hazard a guess to say this is still unsupported, as when the Team City agent spawns an IE process it's still in a non-interactive session.
The approach I've taken recently with Selenium is as follows:
Configure a Windows 10 box to auto login with a Selenium service account.
Have an auto run script which immediately locks the machine and starts the Selenium node server in a console app.
Manually start IE as the Selenium user (runas /user:selenium-account "C:\Program Files\Internet Explorer\iexplore.exe") to accept that first run dialog.
Set all the registry settings needed for Selenium / IE.
You may be able to rig up something similar to work the VSTS / Karma. Do post a note here with your solution if you get it working.
If it would help you (and others), I can post my scripts to a GitHub repro. I had been planning to publish them as a Chocolatey package, but I didn't get round to that yet.
I hope that helps.
Update
From the Microsoft docs:
You can run your agent as either a service or an interactive process. Whether you run an agent as a service or interactively, you can choose which account you use to run the agent. Note that this is different from the credentials that you use when you register the agent with Azure Pipelines or TFS. The choice of agent account depends solely on the needs of the tasks running in your build and deployment jobs.
For example, to run tasks that use Windows authentication to access an external service, you must run the agent using an account that has access to that service. However, if you are running UI tests such as Selenium or Coded UI tests that require a browser, the browser is launched in the context of the agent account.
After you've configured the agent, we recommend you first try it in interactive mode to make sure it works. Then, for production use, we recommend you run the agent in one of the following modes so that it reliably remains in a running state. These modes also ensure that the agent starts automatically if the machine is restarted.
And
As an interactive process with auto-logon enabled. In some cases, you might need to run the agent interactively for production use - such as to run UI tests

Puppeteer authentication does not work in headless mode but yes in non headless mode

I'm facing up a strange problem in Puppeteer with authentication.
I've written a script to take some screenshot of a website which required authentication.
In my local computer (windows), when running in command line as node.exe my_script.js; it's working fine (in headless moden which is the default mode).
I've written an upper Java program to manipulate it (dynamically set the path, the node modules path, run the process "nodex.exe my_script.js" every 30minutes, manage timeout of the process,...). It's still working directly running from Eclipse, in headless mode.
Then... I've built/packaged a JAR and running it in a cmd window: java -jar my_jar.jar... and then the script can't authentitcated on the website in headless mode (the answser page just write a message like "you need to be authenticated", which is managed by the http server).
To check what happen, I've just add an option in my nodejs script (so I do not modify my java upper program code) to run chrome in non headless mode; with option headless : false. And... it's working!
I let the option to run in non headless mode, and I create a Windows service to run my jar via a bat file, with the help of nssm... Just to test. I'm really happy to see that all is running fine without seeing any chrome GUI (maybe Windows disable GUI for service, don't know how).
Have I maybe missed something? Or is there a bug in Puppeteer or Chrome to manage authentication in headless mode?
Regards
Alex

PNaCl and Google Chrome 40 on Linux: Compile process could not be created

I am trying to run the part1 application in the getting_started directory of the Google Native Client SDK, and I obtain the following message in my browser:
NativeClient: PnaclCoordinator: Compile process could not be created:
When I visit the http://localhost:5103 I see the string "Loading...", but it never changes to "Success".
What do I need to configure in Chrome in order to be able to use Native Client applications?
My setup:
OS: Ubuntu Linux 12.04 LTS
Browser: Google Chrome 40
Pepper: 39
Root access: no
Not an answer, but a question:
Can you try to get some more log messages out of chrome or the NaCl runtime?
Start chrome from the shell with the environment variable NACLVERBOSITY=4 set. That asks chrome to show what is going on in the NaCl runtime when it has created a NaCl process (for the compiler). Typical messages are something like:
Entered NaClCreateServiceSocket
...
NaClSetUpBootstrapChannel
...
Elf header
...
and some more details. If that shows up, we know that NaCl compiler process creation at least made it that far. Could you then post the log somewhere, and I can take a look?
If it doesn't show up, then the problem is earlier in chrome. In this case, running chrome w/ --enable-logging=stderr -v1 (http://www.chromium.org/for-testers/enable-logging) might give some idea of what is going on in chrome before NaCl process creation.
Same issue.
I changed the chrome://flags settings for NaCl for debugging but we are not using the NaCl debugger at all. I set it back to default and it started working. (So I guess that was the problem?)

Chrome: Attaching nacl-gdb to packaged application loaded as an unpacked extension

I have built a simple NaCl application. For running the application I use technique 2 described in Nacl Developer's guide, which means that instead of running a local server I load my application as unpacked extension to chrome. The application runs fine so far.
Now I want to experiment with nacl-gdb and attach my application to it at startup.
In the NaCl Developer's guide there are only instructions on how to attach nacl-gdb on an application that is run with local server(technique 1). I made a search to the internet and I ended up with the following approach in order to attach nacl-gdb for an application that is being ran with technique 2:
I enabled "Native Client GDB-based debugging" flag of Chrome.
I started chrome from a terminal like this: ./chrome "--nacl-gdb=gnome-terminal --
/media/sdb1/leonidasbo/AncientRoot/nacl_sdk/pepper_27/toolchain/linux_x86_glibc/bin/x86_64-nacl-gdb"
When Chrome launched, I navigated to my application.
With this approach, Chrome automatically started nacl-gdb when I opened my application.
However nacl-gdb tried to attach but with no success. The output was the following:
*This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=x86_64-nacl".
Reading symbols from /opt/google/chrome/nacl_irt_x86_64.nexe...(no debugging symbols found)...done.
Don't know how to attach. Try "help target".
(gdb)*
It seems that gdb cannot attach to my application. I tried executing "target exec /path/to/my.nexe", but nothing changed.
Am I missing something here? Is there any other way to debug applications loaded as unpacked extensions with nacl-gdb?
My OS is Ubuntu 12.04 and I am using pepper_27 of nacl_sdk. Chrome version is 27.0.1453.93.
Thanks
I assume you were using this guide, which I was using earlier as well. It is out of date. These are the real instructions. It seems that the way you attach the debugger has completely changed, and it is no longer possible to use --nacl-gdb (that is planned for removal). You must manually attach the debugger by following these steps.
The full guide is here, but I'll summarize:
Launch Chrome with chrome --enable-nacl --enable-nacl-debug --no-sandbox --disable-hang-monitor.
Run <NACL_SDK_ROOT>/toolchain/win_x86_newlib/bin/x86_64-nacl-gdb (with no arguments).
Enter these commands into the gdb prompt:
(gdb) nacl-manifest <path-to-your-.nmf-file>
(gdb) nacl-irt <CHROME-DIR>/nacl_irt_x86_64.nexe
(gdb) target remote localhost:4014
Now you can use gdb as normal. (If you just want to run the application until it crashes, start by typing continue.)