click on hidden element selenium webdrier

I am trying to automate the below code

click on link—> and then click on link2

please find the html code

<td id=”PanelTable” onmouseover=”this.className=’menulevel1hl';” onmouseout=”this.className=’menulevel1norm'” class=”menulevel1norm” onclick=”PopupWin(‘Left’,divMenu20110329014658433878,this,’.menuitempopuprownormal’,’.menuitempopuprowhighlight’,”,’.menuitempopupscroll’);”>

&nbsp; link&nbsp;
<div id=”divMenu20110329014658433878″ name=”actiondiv” style=”visibility:hidden;position:absolute;border:”>

<DIV myonclick=”window.parent.location.href=’/smcfs/console/';”>


<DIV myonclick=”window.parent.location.href=’/smcfs/console/';”>



Please find the code written below

WebElement ele = driver.findElement(By.xpath(“//div[@id=’divMenu20110329014658433878′]/div[1]”));

String js = “arguments[0].style.height=’auto'; arguments[0].style.visibility=’visible';”;
JavascriptExecutor executor = (JavascriptExecutor)driver;

executor.executeScript(js, ele);

System.out.println(“element is ” + ele.getText());

executor.executeScript(“arguments[0].click();”, ele);

when I try to print the link it showing correct,but try to click on the element it is navigating to another link

can anyone suggest me what went wrong ?

julagantib Default Asked on October 11, 2015 in Selenium WebDriver.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.