selenium-rc

How do I use the HTMLUnit driver with Selenium from Python?

≯℡__Kan透↙ 提交于 2019-11-28 19:40:40
How do I tell Selenium to use HTMLUnit? I'm running selenium-server-standalone-2.0b1.jar as a Selenium server in the background, and the latest Python bindings installed with "pip install -U selenium". Everything works fine with Firefox. But I'd like to use HTMLUnit, as it is lighter weight and doesn't need X. This is my attempt to do so: >>> import selenium >>> s = selenium.selenium("localhost", 4444, "*htmlunit", "http://localhost/") >>> s.start() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.6/dist-packages/selenium/selenium/selenium.py"

Selenium and :hover css

这一生的挚爱 提交于 2019-11-28 12:03:26
Using selenium-rc and the java client, I want to test a menu which opens when the user moves the mouse over it. It closes when the mouse leaves the menu. This is done using :hover css, without any javascript. In selenium, there are many methods for mouse actions, but none of them seems to trigger any css :hover style to be used. Google shows that I am not alone with this problem, but there has not be a solution. Some folks comment that you had to add some javascript code; however, in selenium rc, I don't think that I even have a proper place for user-contributed additional javascript code. My

WebDriver Chrome Browser: Avoid 'Do you want chrome to save your password' pop up

[亡魂溺海] 提交于 2019-11-28 11:57:10
Every time my webdriver tests login into the application, 'Do you want chrome to save your password' pop up appears.. Is there a way to avoid this?? Please help. Thanks, Mike You need to configure the following chrome driver options: chromeOptions: { prefs: { 'credentials_enable_service': false, 'profile': { 'password_manager_enabled': false } } } I'm using Python, and this worked for me: from selenium import webdriver from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_experimental_option('prefs', { 'credentials_enable_service': False, 'profile'

How can I press the alert ok button programmatically?

自古美人都是妖i 提交于 2019-11-28 09:38:38
问题 How can I press the OK button in a JS alert programmatically? What I want to do: every time after the alert is created, the OK button is pressed. This is for a UI test using Selenium RC. Also, I have already checked: Click in OK button inside an Alert (Selenium IDE). Edit: I had already used chooseOkOnNextConfirmation() and placed it before clicking the button the generated the alert. I also tried placing it after. Nothing worked! 回答1: If you can actually see an alert dialog, then it can't be

How to send an http RequestHeader using Selenium 2?

非 Y 不嫁゛ 提交于 2019-11-28 09:30:19
I needed to send an Http request with a few modified headers. After several hours trying to find an equivalent method to that of Selenium RC Selenium.addCustomRequestHeader for Selenium 2, I gave up and used JavaScript for my purposes. I have expected this to be a lot easier! Does someone know a better method? This is what I have done: javascript.js var test = { "sendHttpHeaders": function(dst, header1Name, header1Val, header2Name, header2Val) { var http = new XMLHttpRequest(); http.open("GET", dst, "false"); http.setRequestHeader(header1Name,header1Val); http.setRequestHeader(header2Name

Selenium: How to select an option from a select menu?

﹥>﹥吖頭↗ 提交于 2019-11-28 07:45:00
问题 I am writing a Selenium test in PHP using the PHPUnit Selenium extension. I know how to type something into a text field: $this->type('fieldName', 'value'); But how do I select an option from a drop-down menu? 回答1: To expand on the other (accurate) answers, you can select based on the label, value, id, or index of the options. From the official reference available at http://release.seleniumhq.org/selenium-core/1.0/reference.html: select(selectLocator, optionLocator) Arguments: selectLocator -

How to disable Flash in selenium remote webdriver

拈花ヽ惹草 提交于 2019-11-28 07:21:27
问题 How do I disable the loading of flash objects when using Selenium Remote WebDriver. It will be helpful if I get a solution for the normal webdriver also. Since in most cases the Flash object is loaded by a JavaScript I have tried disabling the javascript on the webdriver and remote webdriver both, but it does not work. I tried to to disable the JavaScript by: WebDriver driver = new FirefoxDriver(); ((DesiredCapabilities) driver.getCapabilities()).setJavascriptEnabled(false); I also tried:

“IEDriverServer does not exist” error during running Selenium test with C# in Windows 7

夙愿已清 提交于 2019-11-28 06:19:29
I'm working on Automation framework using WebDriver with C#. Its working fine with Firefox but not with IE. I am getting the following error: IEDriverServer.exe does not exist-The file c:\users\administrator\documents\visual studio 2010\projects\TestProject1\TestProject1\bin\Debug\IEDriverServer.exe does not exist. The driver can be downloaded at http://code.google.com/p/selenium/downloads/list I am using IE 9 and Windows 7. IWebDriver driver = new InternetExplorerDriver(); driver.Navigate().GoToUrl("http://www.google.co.uk"); IWebElement queryBox = driver.FindElement(By.Name("q")); queryBox

Run chrome browser in inconginto Mode in Selenium

南楼画角 提交于 2019-11-28 06:00:39
I want to run chrome in incongito mode through selenium. I googled enough for it and found how to run chrome directly in incongito mode with the help of this link : Right click on the shortcut of Google Chrome and select "Properties". On "Shortcut" tab on the "Target" field add an –incognito to the end of program path. So in the "Target" field you should have "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" –incognito but I didn't get how to run this in selenium. kailash gaur One other way to launch chrome in incognito mode is to add argument "-incognito" like following:

List of Selenium RC browser launchers

假如想象 提交于 2019-11-28 04:58:17
I am trying to find a full list of Selenium RC browser launchers. So far I've not been able to find any documentation that lists them all. I've gathered the following ones from various sources. *iexplore - Launches IE *firefox - Launches Firefox *safari - Launches Safari *opera - Launches Opera *googlechrome - Launches Google Chrome *chrome - Launches special Firefox profile with elevated security privileges, to bypass Javascript security errors *iehta - Launches IE with elevated security privileges *piiexplore - Launches IE in proxy injection mode *pifirefox - Launches Firefox in proxy