Reputation: 11
I have a scenario where I need to click a button to edit the page, But above this edit button there are links.. when am running the code the mouse automatically moving over those links and masking the EDIT button. Can Anyone Suggest me hoe to click that button
Upvotes: 1
Views: 869
Reputation: 2444
You should hide your elements you don't want to appear on the page with something like
driver.execute_script(document.getElementById('THE_ID_OF_YOUR_ELEMENT').style.display='none';");
If you don't want to use the ID, you can also use the css selector, the xpath, etc...
Upvotes: 0
Reputation: 50909
JavaScript will click on the element regardless its state (covered in your case)
//Java syntax, similar in other languages
WebElement button = driver.findElement(By.id("id")); //locate the button
JavascriptExecutor js = (JavascriptExecutor)driver; //initialize JavascriptExecutor
js.executeScript("arguments[0].click();", button); //click the button
Upvotes: 1