cannot unselect checkbox element not visible - selenium

I'm using robot framework selenium library, trying to unselect checkbox which is checked using
unselect checkbox|id=blahblah but I get element not visible exception.
But when I do select checkbox|id=blahblah it works.
Should't it give element not visible consistently for unselect/select.
Any ideas how to fix this or work around?
I tried click element but same error

try to do it by "click element" may be it run or cross check your locator.

Related

Robotframework checkbox is not clickable

i really try difference staff to try that this script works but no way, i used name, id, selector, xpath didnt work, i use click element, checkbox should be selected, select checkbox, click button, really i do not understand what i am doing wrong.
this is the website code for the check box enter image description here
this is my robotframework script:
click element css=#nutzungsbedingungen
and this is the error that appears on my terminal:
ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (354, 445). Other ele
ment would receive the click: ...
Thanks for your help
That is because the driver is not focusing in the page - for some reason it gets off the page. When it happens to me, I usually click to focus on the nearest element that I want to check.
The other reason could be that there is an iframe, so first you should be get into the iframe and then could check the box.

How to find element by xPath in Ghost Inspector

Hi have to click an element using its xPath in Ghost Inspector but its not working for me, the syntax I tried were:
"xpath=".XPATH
"xpath="XPATH
xpath=.XPATH
xpath=XPATH
all the above thing that I tried didn't worked and Ghost Inspector was saying:
"ELEMENT NOT FOUND"
can any one please help me finding element using its xPath in Ghost Inspector
you should use xpath=//
For example: xpath=//*[#id="main-container"]/div[1]/my-header/div
Documentation: https://ghostinspector.com/docs/test-editor/#targets
I am using developer tools in Chrome and there I can choose (by mouse right click) what value I want to copy. Try to copy xPath, it should work, I use them a lot.

Element not visible as both the menu and submenu hidden

I want to open cric info and then click on 'live score'menu when the submenu opens, click on 'Desktop scoreboard'.
But the problem is live score menu is under a div which is hidden.
ie and this div is under td
"You can check the structure of the page to get detailed info"
so when i try to click the menu element using driver.findElementBy("xpath") i got the element not visible exception.
So i directly used the javascript used by the developer mopen('m2') which does the job of opening the menu but after this when i execute the command to find the submenu element again get the same error"Element not visible exception".
Tried making div visible by executing jscript.
PFB the code i used:
FirefoxDriver d1=new FirefoxDriver();
d1.get("http://www.cricinfo.com");
((JavascriptExecutor) d1).executeScript("mopen('m2')");
((JavascriptExecutor) d1).executeScript("document.getElementById('m2').style.visibility='visible';");
((JavascriptExecutor) d1).executeScript("document.getElementById('m2').style.display='block';");
d1.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
d1.findElementByXPath("//*[#id='mgDdRht']/tbody/tr[3]/td/a").click();
Also tried using the Actions class but everything in vain ,help is really appreciated
Thanks in advance.
You should be able to do this with an Action chain:
Actions builder = new Actions(d1);
Action clickSubMenu = builder.moveToElement(d1.findElement(By.cssSelector(".Nav td:nth-child(2).navLinks")))
.moveToElement(d1.findElement(By.cssSelector("#m0 td:nth-child(1)#mgDd>table:nth-child(1)>tbody:nth-child(1) td:nth-child(2).PopupTabs")))
.click(d1.findElement(By.xpath("//*[#id='mgDdRht']/tbody/tr[3]/td/a"))).build();
clickSubMenu.perform();
I tested this in c#, and it worked for me. I translated it to Java, but I may have made a syntactical error. Apologies if I have.
What I found is that I needed to move to Series. Then I had to move to Series - the dropdown version, as the dropdown version of Series is a different element than the non-dropdown version. Then I was able to move to the West Indies link, and click it.

element present but hidden selenium check

How can I check if an HTML element is hidden (display:none:) with selenium IDE?
In my case the html is a button and I want selenium to announce me if the element is hidden.
If I use verifyElementPresent, selenium will find the element although is hidden.
Thanks!
You can use any derivation of the storeVisible command.
Most notably, assertVisible and waitForVisible have been useful for me in the past.
if you want to check whether a HTML button is hidden or not just use command verifyvisible
command:verifyVisible
Target:id of the button
if your button is visible it will not throw error but if it not visible it will throw error
Thank You.

Selenium 2.0 Found Element But Unable To Click

I am using Selenium 2.0 for C# to find a radio button and click it. The code is as below:
IWebElement t = driver.FindElement(By.XPath("//table[#id='ctl00_Main__objObjectivesFeedback_ctl39']/tbody/tr/td[2]/input[#type='radio']"));
t.Click();
If I do a Console.Write(t.GetAttribute("name")), it returns the correct element name, however, click does not work.
Btw, I am using FireFox 3.6.20.
Try
t.SendKeys(Keys.Space);
If it works the only downside is SendKeys does not wait for the page to finish loading if the event caused the page to reload. Usually not a problem for radio buttons but it's something to keep in mind.