hi when we have to change tags attribute value with the help of javascriptexecutor in selenium webdriver (java) we use like belwo :
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.getElementById('//id of element').setAttribute('attr', '10')");
and elements attribute is changed.
Also while automating a website i have to click a button i have used normal webdriver
driver.findElement(By.xpath("//*[data-dismiss='modal']").click();
to click it but always i got Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: element not visible. the html source for that button is
<button class="indigo-submit btnStyle clsmdl" data-dismiss="modal" aria-hidden="true">Close</button>
also i have noticed that if i use Actions of selenium over the button i get no exception but even no click at the button i.e my script pass with no exception but also it does not click. after doing a lot search what i found that
<body style="overflow: hidden;">
...
...
< <button class="indigo-submit btnStyle clsmdl" data-dismiss="modal" aria-hidden="true">Close</button>
...
...
</body>
Style attribute of body tag is "overflow:hidden" which as per How to check what is causing a web element to be invisible to Python Selenium? link Some users say Selenium cannot click a web element which is under a parent node with overflow: hidden.Also i have tried the suggestion provided in the link but no luck ,may be i am not able to convert python code into java correctly.
1.Now Please help me how can i use javascriptexceutor to change the body style tag to
visible.
2.Please help me how can i use javascriptexceutor to change the button aria-hidden tag to
false. Also i want a way to verify the same.