Display results as :

Rechercher Advanced Search

Latest topics
» Selenium WebDriver Integration
Tue Nov 21, 2017 1:06 pm by azharuddin

» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce


Problem with anchor tag target attr value _blank

View previous topic View next topic Go down

Problem with anchor tag target attr value _blank

Post by srividya on Mon Apr 18, 2011 4:50 pm

Using Selenium(Java client) , I want to Click a link on a page, which will open a new browser window and need to test some content in newly opened browser window.

My problem is that i cant able to target that new window and check to see if that page loaded.

I tried with the following approaches,

First Approach:

//Retrieve href attribute value of anchor tag
String path=selenium.getAttribute("//img[@alt='myimage']/parent::a@href");
//Remove target attribute of anchor tag
//Update href attribute value
//Click link

Problem with this approach is that the new window link is getting opened as a sub frame in the main window,but i want it to be opened in a new window.How can i do this?

Second Approach:

//Update target attribute
selenium.getEval(""//img[@alt='imagetitle']/parent::a").target='myWindow'"); selenium.getEval("this.browserbot.getCurrentWindow().open('${path}', 'myWindow')")); selenium.clickLink("//img[@alt='imagetitle']/parent::a");
ClsWebControls.selectWindow("myWindow"); ClsWebControls.windowFocus();

Problem with this approach is that a new browser window is getting opened, but i cant able to target that new window using selectWindow command.Following exception is getting raised:
com.thoughtworks.selenium.SeleniumException: ERROR: Could not find window with title "myWindow"

Does selenium support anchor tag with target '_blank'?
Also please suggest me solutions for the problems mentioned in the above two approaches.


Posts : 1
Join date : 2011-04-18

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum