selenium-rc

How do I test which element has the focus in Selenium RC?

空扰寡人 提交于 2020-01-24 03:05:42
问题 How do I test which element has the focus in Selenium RC? 回答1: I couldn't get the :focus pseudoclass idea to work, not sure why - targeting css=#search_input input.text matched, but css=#search_input input.text:focus didn't? But here is what worked for me: self.assertEquals(self.se.get_element_index('dom=document.activeElement'), self.se.get_element_index('//input[@id="search-query"]')) This is using the Python Selenium API, so the get_element_index() calls are wrappers around the core

Read Message From Alert and click on OK

∥☆過路亽.° 提交于 2020-01-23 05:46:04
问题 I want to read the message which is there in Alert. Example: If a alert shows "Wrong E-mail address". How to read it? Means i want to store that message in a string. How to click on OK inside Alert...?? How to do it using Selenium ? 回答1: I am assuming you are using the Selenium WebDriver. // Get a handle to the open alert, prompt or confirmation Alert alert = driver.switchTo().alert(); // Get the text of the alert or prompt alert.getText(); // And acknowledge the alert (equivalent to clicking

Timed out after 30000ms when I tried to go next page by clicking Submit button using Selenium RC

我是研究僧i 提交于 2020-01-21 14:56:26
问题 I am using Selenium RC by java. Fill up necessary data on 1st page--> Click Submit button to go next page. My code is: selenium.click("Submit"); selenium.waitForPageToLoad("30000"); After clicking Submit button I found the error: com.thoughtworks.selenium.SeleniumException: Timed out after 30000ms Can anybody pls help me? 回答1: Selenium.waitforpagetoload("30000"); means you are giving time 30000 m.s= 30 seconds It means your page is taking more than 30 seconds to load completely. So in order

How to use Xpath of button in Selenium RC?

心已入冬 提交于 2020-01-17 01:55:08
问题 I am working in Selenium RC. Can anyone please let me know how to write xpath for button in Selenium (Java)? 回答1: You should develop the script in the Selenium IDE (download) before porting it to Selenium RC. In Selenium IDE, when you click anything on the webpage, it should automatically generate some kind of selector for the element you clicked. Then, once you've recorded all the events, you Format it in whatever language you're using, and then you copy and paste it to your Selenium RC code

Selenium Webdriver: The method alert() is undefined for the type WebDriver.TargetLocator

你离开我真会死。 提交于 2020-01-15 11:59:06
问题 I am trying to handle alerts using Selenium Webdriver, according the selenium documentation the correct implementation is: Alert alert = driver.switchTo().alert(); However I am getting error message The method alert() is undefined for the type WebDriver.TargetLocator what version of Selenium 2 has this web driver api 回答1: I'm using selenium 2.3 and it works for me. From what I've seen, alerts only work with windows that ONLY have the ok button. Thats where you put the alert.accept();

junit.framework.AssertionFailedError: No tests found in register

痴心易碎 提交于 2020-01-14 14:06:11
问题 I'm having a problem getting this test case to work. Can anyone point me in the right direction? I know I'm doing something wrong, I just don't know what. import org.junit.*; import com.thoughtworks.selenium.*; import org.openqa.selenium.server.*; @SuppressWarnings("deprecation") public class register extends SeleneseTestCase { Selenium selenium; private SeleniumServer seleniumServer; public static final String MAX_WAIT = "60000"; public final String CRN = "12761"; public void setUp() throws

from selenium test scripts back to selenese

删除回忆录丶 提交于 2020-01-14 03:13:12
问题 I've got a bunch of test scripts written using Test::WWW::Selenium (but the fact that I used perl is inconsequential, any language selenium supports probably has the problem I describe). When the cogs in my application come loose I'd like to replay the test using the Selenium IDE, letting me have full control over the action But I'm not sure how to go from my test script back into the selenium IDE, you can't paste perl into the IDE and have it transmogrify back to "HTML" (aka, internal

How to mouseover a WebElement using Selenium RC2 in Firefox

情到浓时终转凉″ 提交于 2020-01-13 14:05:30
问题 Using Selenium's Firefox WebDriver 2.20, I need to display a tooltip that appears when the mouse hovers over a link on my web page. I've tried using Selenium's Action class to do this, but I get a ClassCastException: $Proxy7 incompatible with org.openqa.selenium.internal.Locatable. Here is what I've tried so far: Actions builder = new Actions(driver); WebElement link = driver.findElement(By.tagName("a")); builder.moveToElement(link).build().perform(); The ClassCastException happens in the

How to mouseover a WebElement using Selenium RC2 in Firefox

流过昼夜 提交于 2020-01-13 14:04:05
问题 Using Selenium's Firefox WebDriver 2.20, I need to display a tooltip that appears when the mouse hovers over a link on my web page. I've tried using Selenium's Action class to do this, but I get a ClassCastException: $Proxy7 incompatible with org.openqa.selenium.internal.Locatable. Here is what I've tried so far: Actions builder = new Actions(driver); WebElement link = driver.findElement(By.tagName("a")); builder.moveToElement(link).build().perform(); The ClassCastException happens in the

Facebook test accounts using selenium - failing to log in my fake users

夙愿已清 提交于 2020-01-11 03:42:06
问题 I am programmatically creating test accounts, and then immediately trying to log in w/ them using a selenium driven browser. Unfortunately, the browser is just redirected to the facebook homepage. I can briefly see what appears to be the correct url prior to the redirect flash by, so I have no reason to believe the browser isn't going where I intend it to. That said, if create a fake account, and then just paste the login_url into a browser, things work fine. Anyone have any idea why that