How can I run the InternetExplorerDriver through a linux VM? - selenium

What are the options here as our plan is to be able to execute selenium tests on a linux (CentOS) vm using jenkins to schedule the execution using selenium and we only need to test Internet Explorer 9 at this time.
Has anyone had any luck using Wine with them?
What are my other options?
Thanks.

Hmm, consider this more like a guess than an answer:
I would go by the path of investigating the Selenium Grid in setup that your main machine with CentOS would play "hub" role and virtual machine would be "node" - Everything you need to investigate is how to "see" the virtual machine by entering its IP. I think this should be somehow possible, but do not know how to setup it

Related

How does selenium behave without an "active session"

I've been working with Selenium for a few years already.
I started with some little stuff in Java and in my previous job I did a project using C# bindings with SpecFlow framework, page objects model, I dealt with complex locators, some JavascriptExecutor even some browsermobproxy work, bottom line I have some experience with Selenium.
Still there is something that is not clear to me.
Is Selenium expected to work properly when there is no "interactive session" into the machine that is running the code ?
Let's say that I connect into remote desktop to a machine in the cloud (Let's say Amazon or Azure), I develop a script and schedule a windows job to run it on the next 10 minutes, then I disconnect from the remote desktop session, the machine is on but no user is connected to it in remote desktop.
Will the script work ? Or depends what does it do ? Might some of the actions not work (Script might include changing the window size, sending keystrokes both through selenium sendkeys and by OS level actions) ? Can we ensure that any script that we developed and works OK while we are connected to the machine will also work when I'm not ?
I hope the question is clear, if not I can maybe explain further
Thanks !!!
Yes, Selenium can run on the cloud machine even though you are not connected to it. It should work without any issue.
As per my knowledge cloud machines are protected by firewall which blocks almost all the ports. You may need to get permission to use the default selenium ports like 4444 or 5555.
Also, may need to increase wait time because the cloud machines are slow in performance compared to normal physical desktop.
Usually cloud machines are linux based, you need to consider the environment as well.

Running scraper bot on remote server

Is there a way to run python script which uses selenium on remote linux server?
I would like to connect via ssh, upload the script and have it working 24/7.
But I am not sure if such script which normally is based on interacting with browser would work.
This script logins to facebook and then do some stuff which help me with my work and I would like to put it on remote server so I don't have to run my pc all thetime.
Thanks in advance.
This is definitely doable, what u need can be simplified to:
your scraper script (python is installed on some Unix machines, so no
need to worry about the runtime environment)
cron job (CI server if you need some more complex behavior)
selenium driver binaries
Xvfb setup
(optional) some deploy.sh that will automatically put your new code versions on the VM

Is it possible to run SikuliX on a host computer and have the script interact with virtual machine?

Currently running Windows 10 (native) and VMware Workstation 12 Player. I am running various LTS releases of Ubuntu in VMware.
I am wondering if there is way for me to run SikuliX on my main OS, Windows 10, and have the script interact with a virtual machine, running an Ubuntu OS, that I have open.
The quickstart documentation on the download site isn't very specific about the limitations of SikuliX on this topic. It simply says that you can't run it on a headless system (which VMware is not), and you need to have a monitor - the only problem is that I have no idea if SikuliX considers VMware to be a legitimate monitor or not.
I am aware of the fact that you can install Sikulix on the virtual machine itself, but this is not preferable as I would have to possibly reconfigure my VM settings to allocate more memory OR just deal with running the script at a slower pace.
Any help would be greatly appreciated.
The answer is yes, if you run SikuliX on a native host, it is possible to interact with the the interface of the virtual machine the same as running SikuliX on the virtual machine itself.
Now that I think about it, I should have probably tested this out before posting the question, but hey, if anyone has the same question as I do, now you know.

How can anyone run access Selenium test scripts without having to install/run it locally?

I am looking for ways to set up like a central 'hub' for Selenium in my work, allowing anyone to access in within the company. For example, Tester A writes test scripts, the Person B can run without having to manually copy over the test scripts to their local workstation)
So far, I've only thought of installing Selenium in a VM which will then execute as per normal. But if I run Selenium Grid, it will run VMs within VM (?). My only concern with VMs is that it'd run slowly.
If anyone can think of a better solution or recommendation please do give me some advice. Thank you in advance.
One idea. You can create an infrastructure combining Jenkins/Selenium/Amazon.
The following is my solution from another post.
You can do it with a grid.
First of all you need to create a Selenium hub with an EC2 ubuntu 14.04 AMI without UI and link it as a jenkins slave to your Jenkins master. Or as directly a master. What you want. Only command line. Download Selenium Server standalone. (be careful on downloading the version. If you Download the Selenium3Beta, things could change). Here you can configure the HUB. You can also add the Selenium Hub as a service and configure to run automatically at server start. its important that you open the Selenium default port (or the one that you configured) so the nodes can connect to it. You can do that on the Amazon EC2 console when you have created your instance. You just need to add a security group with an inbound rule for TCP in the port you want for the IPs you want.
Then, you can create a Windows server 2012 instance server (for example, that's what I did), and do the same process. Download the same version for Selenium and the chromedriver (there is no need to download any firefoxdriver for Selenium versions before Selenium3). Generate a txt file and prepare the Selenium command to link to the HUB as a NODE. And convert it to *.bat in order to execute it. If you want to run the bat at start you can create a service with the task scheduler or use NSSM (https://nssm.cc/). Don't forget to add the rules to the security groups for this machine too!
Next, create the Jenkins server. You can use the Selenium Hub as the Jenkins master or as a slave.
Last step is configuring a job to be run in the Jenkins-Selenium machine. This job needs to be linked to your code repository (git, mercurial...) Using the parametrized build plugion for jenkins you can tell that job to pull the revision you want (where every developer can pull the revision with the new changes and new tests) and run the Selenium tests in that build with the current breanch/revision and against one unique selenium. You can use ANT or Maven to run the Selenium tests in Jenkins.
May be it's complicated to understand because there are so many concepts here but it's robust and it works fine!
If you have doubts, tell me!
If Internet Explorer is not one of the browsers on which you must run your automation tests, I would recommend that you consider docker selenium.
Selenium is providing pre-configured docker images for both Selenium Hub and Node ( refer here for more information ). For making use of docker selenium all you need to do is find a machine (preferably unix machine), install docker on it by following instructions detailed here and then start the hub and node by starting off those containers. In the case of docker you can literally transform a VM (or) a physical machine into a VM farm and yet not have to worry about slowness etc., because I believe docker is optimised for these and it runs your VM as a process.
Resorting to using Amazon cloud for running your selenium nodes is all fine, but if you have corporate policies that prevent in-coming traffic from the internet into your intranet region, then I am not sure how far Amazon cloud would be useful.
Also remember that Jenkins is not something that is absolutely required but is more of a good to have part in the setup because it would let anyone run their tests from a web UI. This will however require that all your tests are checked-in and made available in a central version control system in your organization.
PS : The reason why called out Internet Explorer as an exception is because IE runs only on windows and there are no docker images (yet) for windows. All the docker images are UNIX based images.

How can I run Selenium tests when my site is in Vagrant?

I use Vagrant for my local development. Now I want to use Selenium for automated browser testing. When I setup Selenium in my VM, it works like a charm (great stuff by the way).
But now I want to move the Selenium testing out of the box. I tried to run the Java server on my host machine, forward port 4444 to port 4444 in virtualbox, and then fire the phpunit-command in VirtualBox, hoping to trigger the server on my host machine.
But instead I get a CURL-message that phpunit can't connect to 127.0.0.1:4444, so obviously there is no connection to my host machine on this port.
Can anyone tell me what I'm doing wrong?
Edit: I figured out that when I'm running the server on the host, I cannot access 127.0.0.1:4444 in my browser, however, I am able to access localhost:4444. Which is weird, because my hosts-file has the correct line (although it shouldn't matter since phpunit is trying to access a numeric address).
I think the best solution for this is to setup a "private network" this way you'll be able to use internal address to access your vm and host separately...
Depending of your vm provider different solution are possible (for example, Virtualbox support internal netowrk only)
Have a look at : http://docs.vagrantup.com/v2/networking/private_network.html