click # checkbox is done but not registered - selenium

I`m relatively new to Selenium and trying to create some test cases with the Selenium IDE.
I just selected a checkbox with XPath with the following command xpath=//input[starts-with(#id,'003g')].
After the checkbox is selected, I click another button to add the value from the checkbox.
But nothing happens. The application always tells me that no record is selected... If I push the play button I can see IT IS selected.
What to do?
Thank you guys!
edit:
At first... Thanks for your help!
I don`t think, the problem is caused due the fact that the element is not present. I can see that Selenium selects the according data record (checkbox)
Here is some code. I hope it will help! In fact I am new to this whole webstuff and have no clue about web techniques.
<td class="x-grid3-col x-grid3-cell x-grid3-td-checkbox x-grid3-cell-first
"tabindex="0" style="width:18px;">
<div id="003g0000006ElPO_checkbox" class="x-grid3-cell-inner x-grid3-col-checkbox">
<input id="003g0000006ElPO" class="checkbox" type="checkbox" name="ids" title="<a
href="/003g0000006ElPO">
<span>JeanneSeleniumOne</span></a>" value="003g0000006ElPO">

There's too little information to help, but a wild-guess would be the element wasn't ready to be clicked i.e. you should wait for some time before clicking.
I just posted a similar answer here

Related

How can I access a button to click it with following code in selenium webdriver?

There are many buttons sharing the same class.
May have to go with clicking the link /account/logout'.
This is the code I'm trying to use:
input class="btnRed text-uppercase fo_white" value="Logout" onclick="window.location.href='/account/logout';" type="button"
Hard to say because you didn't provide enough info, but you could probably make it work by using value attribute. Something like this if you are using java.
driver.findElement(By.cssSelector("[value='Logout']")).click();
Not pretty solution, but give it a try:
driver.findElement(By.cssSelector(".btnRed.text-uppercase.fo_white")).click();
Looking at your HTML DOM this command will work for you:
driver.findElement(By.xpath("//input[#value='Logout']")).click();
Let me know if it works for you.
Looking at your HTML, this should work
driver.findElement(By.xpath("//input[#value='Logout'][#type='button']")).click();
Let me know if it works.
Is your element visible/enabled? In order to select an element, it must be present in your DOM. If the element is activated through an event, it cannot be selected until the event occurs.
Take a look at this post. This other post also have good ideas.

click on submit button not working in selenium webdriver

I trying to click on the create account button in registration form.
this is how the button locate in the html page:
<div id="submitContainer"><button type="submit" class="large"><span><strong> Create Account </strong></span></button></div>
this is the button xpath:
//*[#id="submitContainer"]/button/span/strong
the problem is that the button don't have id, he locate inside a div.
I try to use by id,xpath,css,name, but all of this not working:
driver.findElement(By.id("submitContainer")).click();
driver.findElement(By.xpath("//*[#id='submitContainer']/button/span/strong")).click();
driver.findElement(By.tagName("Create Account")).click();
driver.findElement(By.className("large")).click();
thanks!
In your examples, except for the last one, you are not targeting the button. Now your last example, should actually locate the button-element:
driver.findElement(By.className("large")).click();
Could you please post the error message you are getting?
Are there more than one element on the page with className "large"?
Make sure the button is in view window, if it is then try clicking on it. Try to wait for the element to load. There might be an issue with your element being loaded into DOM -
driver.wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//button[#type='submit']"))).click();
Hope this helps.
If you want to use xpath, the correct syntax is
//button[#type='submit']
Use this line below:
Thread.sleep(3000);
I got the result once I used this one. Since some time we need to give some sleep time for the site to load fully to pull the Xpath.
You can use the linkText
driver.findElement(By.linkText("Create Account")).click();
Hope it will work for you.

selenium code for accessing button type submit

i want to access the submit button having code
<input class="btn btn-primary" type="submit" value="Save">
I have tried for ;
driver.findElement(By.name("Save")).click();
and
driver.findElement(By.name("Save")).submit();
but raising an error of : No such element Unable to locate Element
Your element has no name, it has a tag and some class names which may or may not be unique across the page you are testing. These may work but we might need to see more of the page.
driver.findElement(By.className("btn-primary")).click();
driver.findElement(By.cssSelector("btn.btn-primary")).click();
You may find the page http://docs.seleniumhq.org/docs/03_webdriver.jsp useful as it gives you an introduction to the different ways to find elements on the page.
Add a sleep time or wait before the submit.
Thread.sleep(5000);
driver.findElement(By.name("Save")).click();
I think this will solve your problem

How to check if element is been dragging with Dojo

What to check if an element is been dragging to make a report of how many times has been dragged, any idea? with dojo of course.
This is the element to be sensed.
<p id="id_number" class="button">Button_name</p>
Please be more clear. I suppose you mean you want to use dojo/dnd/Moveable on your DOM node to make it draggeable? If you look at the API documentation you will notice that it has an event called onDragDetected which will be useful to you. Just increment a counter with it and you're done.

Selenium webdriver : Unable to click a link (Not inside iframe- able to print gettext value from the webelement)

Please don't make comments regarding why i posted a similar question. I have tried many things and nothing is working. Below is the HTML
<div id="businessSettingsColumn1">
<div class="sectionLink">
Business details
</div>
<div class="sectionLink">
Operating hours
</div>
<div class="sectionLink">
Closed dates
</div>
<div class="sectionLink">
Appointment notifications
</div>
I need to click the second link
I have tried
1) webdriver.findElement(By.partialLinkText("Operating hours")).click();
2)webDriver.get(mylement.findElement(By.tagName("a")).getAttribute("href"));
3)
List<WebElement> businessLinks= busCol.findElements(By.className("sectionLink"));
for(WebElement bLink :businessLinks) {
if(bLink.getText().contains("Operating hours")) {
bLink.findElement(By.tagName("a")).click();
}
}
4) Using the Action builder to move the mouse and then doing a click
Also when i did this 3 times in a row , my element got clicked
webdriver.findElement(By.partialLinkText("Operating hours")).click();
webdriver.findElement(By.partialLinkText("Operating hours")).click();
webdriver.findElement(By.partialLinkText("Operating hours")).click();
I am using Firefox version 25.0 and Selenium version 2.35.0. Funny thing though is when i do a sysout , the values get printed and when i try to get the url using webdriver I get "Element not found in the cache - perhaps the page has changed since it was looked up" .. its pretty much a static page with links only so i dont understand why i am not able to click it.. Any help will be much appreciated.
Can you try calling focus() on the element before you click on it?
This usually occurs because the element was there at some point, but then something happened and then it's no longer there for some reason. I encounter this frequently when a page makes AJAX calls for example.
Have you tried adding some waits so that selenium is sure that the element is ready?