I've worked one a project, in which I display a list of names and their corresponding hyperlinks, each hyperlink text is different, so it would look something like this,
Using the following line of code, I am able to get the required element,
arg1 = "http://somesite.com/name3"
WebElement urlElement = driver.findElement("//a[contains(text(), '" + arg1 + "')]");
With this, I do get the urlElement. Now when I click on the urlElement,
urlElement.click();
I was expecting it to open window, so that later down the link, I can call,
driver.switchTo().window("opened window title")
I was expecting this to work but for some reason it fails stating these is no window by that title.