I'm trying to run a Selenium Script (Using PHP) using a Webserver.
I'm working on Kali and to simulate the Webserver I use Xampp.
I tried to run the selenium script on Xampp by the following steps:
-Download the Php Webdriver Bindings, put them in the folder 'htdpcs' of xampp and edit the 'example.php' file following the settings of my own device.
-Download and execute the Selenium Server Standalone, on port :4444.
In the end, I download the geckodriver and I execute the file, but I got the this error:
OSError: [Errno 98] Address already in use
How to fix it in order to run the php-selenium script?
The Selenium Server will fork a geckodriver as soon as it needs one to start a new browser session. You should not start a geckodriver yourself. If you want to use its Webdriver API yourself you can start it with the --webdriver-port argument.
Related
I wrote a script that uses Selenium with Python. When I run the script, it creates a log file in the script directory. When I use the Firefox driver, a geckodriver.log file is created.
Is there an option to set to disable this?
So I made a program that start a headless browser ( Chrome ) with Selenium in Python.
I have a CyberGhost VPN.
When I try to start my script with the VPN active, Selenium open a chrome windows, with "data" in the url but doesn't proceed further.
Otherwise, it works when I start the script with inactive VPN and turn the VPN on when selenium is running normally.
I don't understart what can be the problem ...
Thanks :)
VPN is handled at the OS level, before Selenium gets anywhere near. You can try to setup a config with CyberGhostVPN and run an exec command to start your connection. After that, then start Webdriver and it should be running over VPN. See here on Calling an external command from Python
It may also be due to a firewall issue, so you can also try to deactivate the included firewall in CyberGhostVPN.
I've a strange problem with Python (or maybe I'm only a noob).
I wrote a little bot to automate some action on the browser using selenium and I want to run on a Ubuntu VPS, so I've installed Selenium and the other modules I needed and I ran the script but when it comes to the first of this lines
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "free_play_captcha_types")))
driver.find_element_by_id("free_play_captcha_types").click()
driver.find_element_by_id("free_play_captcha_types").click()
driver.find_element_by_xpath("//option[contains(#value, 'recaptcha_v1')]").click()
I get the socket.error: errno [111] Connection refused error.
I've already tried to run the selenium server before running the script but nothing changes... has someone have an advice?
Thank you in advance.
Another information: I ran the same script on a different VPS and it ran successfully...
I'm trying to use selenium from python but I'm having a problem running it on a RHEL5.5 server. I don't seem to be able to really start firefox.
from selenium import webdriver
b = webdriver.Firefox()
On my laptop with ubuntu this works fine and it starts a brings up a firefox window. When I log in to the server with ssh I can run firefox from the command line and get it displayed on my laptop. It is clearly firefox from the server since it has the RHEL5.5 home page.
When I run the python script above on the server it (or run it in ipython) the script hangs at webdriver.Firefox()
I have also tried
from selenium import webdriver
fb = webdriver.FirefoxProfile()
fb.native_events_enabled=True
b=webdriver.Firefox(fb)
Which also hangs on the final line there.
I'm using python2.7 installed in /opt/python2.7. In installed selenium with /opt/python2.7/pip-2.7.
I can see the firefox process on the server with top and it is using a lot of CPU. I can also see from /proc/#/environ that the DISPLAY is set to localhost:10.0 which seems right.
How can I get a browser started with selenium on RHEL5.5? How can I figure out why Firefox is not starting?
It looks like the problem I'm encountering is this selenium bug:
http://code.google.com/p/selenium/issues/detail?id=2852
I used the fix described in comment #9 http://code.google.com/p/selenium/issues/detail?id=2852#c9
That worked for me.
I have few questions in Selenium WebDriver (Selenium2) :
My 1st question is, do I need a standalone .jar file for RemoteWebDriver?
My 2nd question is, if the standalone .jar file is needed, then how can I start this .jar file/Selenium Server from the WebDriver's Client side (just like in Selenium RC) using Python ?
I do know how to start the selenium server from command line locally. But I was wondering if WebDriver has any improvements from RC regarding starting the Server. I am also aware that there is no need of a Selenium Server (standalone .jar file) if WebDriver is used locally.
Yes standalone jar file need to be in running state, in order to run tests on remote machine using RemoteWebDriver.
To run the server, just use java -jar that probably you know already.
refer: http://code.google.com/p/selenium/wiki/RemoteWebDriver for more details.