2

I am doing some web automation using Selenium RC. Am new to Selenium RC and am facing problems (may be learning curve) while doing automation. I am using java with Eclipse IDE to code selenium RC.

Scenario: I have a screen with a link. while clicking, it will open a lookup window which contains lot of names (grid). Now I have to select a value from grid by directly clicking any row/record. Or I can use search option and select the record. The problems are

  1. my recorded script is NOT responding to pop-up windows.
  2. Is there any command for "double-click" in selenium.

@rs79 - It didn't work for me. Here is my code:

selenium.click("link=eName");   //click the link to open the lookup window
//lookup window
selenium.focus("Associate"); <br>
selenium.waitForPopUp("Associat", "20000");
selenium.selectWindow("Associat");
selenium.type("id=SearchTextBox", "xyz"); //Enter the text in search field of lookup
selenium.click("id=SearchButton"); // click search button on lookup window <br>

Please correct me if I am wrong. Appreciated if anyone give me more suggestions.

Kev
  • 118,037
  • 53
  • 300
  • 385
Rank
  • 31
  • 2
  • 6

3 Answers3

1

Without access to your DOM, I would recommend recording using the IDE, and adapting the right context from the recorded actions into RC. The IDE does a decent job of capturing the context for popups and modals.

After the capture, here are some gotchas:

  1. For iFrames, change the captured frame id to a more generic (css) locator
  2. Be wary about the difference between selectWindow() and selectFrame()
Community
  • 1
  • 1
rs79
  • 2,311
  • 2
  • 33
  • 39
0

If its a popup not an popup window then you can try the firebug to locate the element or record you want.
Now copy its xpath and use it in your code.

Same problem I have faced and solved by this method as xpath from fire bug is detailed and locates the proper window.

After coping xpath please verify the path has // at starting.

Thanks

lAH2iV
  • 1,159
  • 2
  • 12
  • 28
-1

This will help to handle salesforce lookups

Iterator it = windows.iterator();
String parentwindow =(String) it.next();
String childWindow =(String) it.next();

// Switch to parent window
driver.switchTo().window(childWindow);
MiscUtils.pauseForElementToBePresent(3000L);
driver.switchTo().frame("your frame NAME/ID");
MiscUtils.pauseForElementToBePresent(3000L);

// your step to perform on child page.
driver.findElement(By.linkText("123Test")).click();
MiscUtils.pauseForElementToBePresent(3000L);

//if popup is getting close automatically switch to parent window otherwise use "driver.quit();" to close popup
driver.switchTo().window(parentwindow);
driver.switchTo().defaultContent();
Michael Hoeller
  • 22,018
  • 10
  • 39
  • 66