The page has an image with a hyperlink and that the hyperlink has target = "_ blank", and every time I click this image, a new firefox loads and the hyperlink redirects to this new firefox web page and I lose control of this web page. Is it possible to delete or change this target = "_ blank" on the hyperlink, bcause I want to load the web page into the same webdriver
WebDriver driver = new FirefoxDriver(); driver.get("http://www.page.eu/"); WebElement submit; submit = driver.findElement(By.xpath("//img[@alt='page']")); submit.click();
that the hyperlink has target = "_ blank" Do I need to somehow change this target using perhaps webdriver + javascript or what? is it possible?
edited
thanks for the suggestions, but still I tried to make this problem as Grooveek , but no changes
WebElement labels2 = driver.findElement(By.xpath("//a[@href='http://tahtpage.net']")); WebElement aa = (WebElement) ((JavascriptExecutor) driver).executeScript("labels2.setAttribute('target','_self')",labels2 ); aa.click();
I have an error org.openqa.selenium.WebDriverException: null (WARNING: the server did not provide any stack information)
I am not good at javascrit, so I think the problem is that the executor
source share