I'm learning Selenium but I am concerned that the Webdriver (Chromedriver.exe, Geckodriver.exe) seems to open a port for communication functioning as a proxy between the selenium code and the browser. I don't want to expose myself to any vulnerabilities and would prefer some form of direct browser communication. I've viewed several solutions, but selenium just seems to be the reigning champion.
It appears that some form of what I am looking for was present with PhantomJS, but that seems to be no longer supported. This leaves me two options:
-Find a browser that selenium can communicate directly with without the aid of Webdriver.
-Find a way to completely restrict that port that it seems to open up so it does not allow connections from anybody on the network and no one can connect to my local machine.
Any suggestions folks?
Related
I have my robotframework setup on my PC.
I would like to connect to a remote windows client, have it open a browser and access a URL.
Verify that the pages has loaded.
Pretty basic but since I am new to RF, I wanted to know how that would work.
For Linux machines, I would use the SSHLibrary and just execute commands (wget) but for the windows machine, I need to use the browsers.
Do I need RF installed on the destination client RDP?
Do I need the webdrivers for each browser on the client RDP?
How would I go about logging in the Windows machine through RDP?
After Logging in with RDP, I run the same "open broswer" with broswer and URL?
Thanks!!!
The use case you describe - a browser to be opened & controlled on a remote machine, is precisely what Selenium solves.
Though in day-to-day work or debugging we are usually starting a local browser, SE is preliminary designed for remote execution. So head to www.selenium.dev, and focus on the Grid - that's the component you are after.
I'm that approach, answers to your specific questions:
no, you need Robot Framework and selenium library on the local machine, and only selenium & webdriver on the remote.
you don't need the drivers on the client - the selenium library is all you communicate with in your code; you need them installed in the remote only.
on the local you will get the logs of the webdriver commands execution; actual browser manipulation logs are only on the remote and the hub (but these are really debugging ones, everything high-level for the functional execution is local).
you don't really log into RDP with this approach (RDP is totally out of the picture here), and yes - your code is the same as running on local browser - Open Browser, Get Text, etc - but, executed on a remote machine.
If you want to see why 1) and 2), head to the answer over here (shameless plug 🙂)
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.
I have done my automation in Robotframework and I am using many libraries like Selenium2Library, Sikuli Library, HTTP Library, OS library and few more.
When I am running test on Selenium Grid, it invokes the browser on node and runs those steps which are from Selenium.
However, it does not run commands from Sikuli Library. Is selenium grid capable of running keywords from different libraries?
No, the selenium grid only works with selenium. The selenium grid is a server much like a web server. It listens for specific commands, and performs those commands. It will only respond to commands from selenium clients.
When using Sikuly in Robot Framework it is necessary to first setup the external sikuly server and then connect to it from Robot Framework. Typically this is a localhost connection, but connecting to an external host is also possible.
When using Selenium Grid, a connection is made to an anonymous node and thus the host to which the Sikuly server is runnning as well. Did a quick check in google and found that getting the hostname/IP of the running node from the hub is possible. Using the code example here I think it should be possible to create a direct connection to the Sikuly server.
I'm using Selenium remote web driver for gui testing. The server is on Linux, the browser is on Windows. Everything works fine when I'm using a 'regular' connection. The first issue is that when I switch from cable to wifi, I have to restart the computer for the remote webdriver to work. But the main problem, is that when connecting to vpn, nothing works at all - the browser won't even open. Has anyone encountered anything like this in the past?
Let me know if more details are required..
Thanks :)
Chrome doesn't allow extensions while running /controlled by selenium. I end up using VPN application(hide me,norvpn) which globally change ip for the running applications on my machine.
i am using webdriverbackedSelenium for my tests , i see that it isn't supporting capture network traffic method. can anyone tell me when webdriverbackedselenium is extending default selenium why isn't it supporting captureNetworkTraffic method
Selenium WebDriver and Selenium RC use fundamentally different mechanisms to automate the browser. RC installed itself as a proxy in some modes of operation, which allowed it to capture all communications between browser and web server. WebDriver's philosophy is designed to more closely emulate the user's experience, including not blindly installing a proxy without the user's knowledge, so WebDriver is not able to capture that traffic by default.
Selenium RC is deprecated, and has been for over two years. It is receiving no attention from the development team, and is unlikely to be improved in the future. However, since many people have significant investments in code using the RC API, the project provides a bridge class, WebDriverBackedSelenium. It is designed to allow you to migrate your RC code to WebDriver over time. It is not intended as a permanent solution. It does not, will not, cannot, and should not implement every single method of the Selenium RC API. It implements enough to allow your code to compile and mostly run, giving you the opportunity to change your code over to the WebDriver API.
If you absolutely require capturing network traffic to the browser using WebDriver, the API allows you to specify a proxy to use with the browser being automated. There are a number of proxies out there which allow you to capture, examine, and even modify the traffic to the browser. Some examples that people have used to good effect are BrowserMob proxy and Fiddler.