Elliot JJ
Elliot JJ

Reputation: 553

Selenium won't detect new window after clicking link

In my selenium script, I click a link (that is inside a frame or something generated so that a search through the source doesn't return it), which sends me to a site that redirects or is a shortcut to a download of a pdf. The pdf appears in a new window when this link is clicked. Unfortunately, SeleniumRC can't detect the new window, even if I use "wait_for_pop_up" (I'm using python btw, if it matters).

WebDriver can detect the new window, so to get around this I've been using a combination of SeleniumRC and WebDriver, but it's so buggy (WebDriver as I'm using it, not the combination) that it's intolerable. I'd rather use SeleniumRC for everything.

How can I get SeleniumRC to detect this window?

Edit: let me clarify the issue: when I tell it go get window ids (window_handles in python), the window I want doesn't even appear, as if SeleniumRC doesn't know it exists. WebDriver can find it and give it an ID though, so I don't know what's up with this.

One more detail: the new window with the pdf has a different (mirror) domain name, could that be an issue?

Upvotes: 0

Views: 4942

Answers (2)

Rakesh Prabhakaran
Rakesh Prabhakaran

Reputation: 381

You can get control on the new window, by just opening that window using selenium again . Ie get the url of the new window manually after clicking on the lick which opens it, then use selenium.open("your new window url"); and go ahead with the rest of operations in that page.

Upvotes: 0

Ashkan Aryan
Ashkan Aryan

Reputation: 3534

there is a good tutorial on how to use multiple windows in selenium here. Maybe instead of waitForPopup you can introduce a manual wait for a set time (say 2 seconds) and then use selectWindow to select the new window.

Upvotes: 1

Related Questions