ihossain
ihossain

Reputation: 353

Submit button not working in Selenium webdriver

When I launch ChromeDriver or IEDriver and click the submit button (manually and automatically), it does not send the inputs. It works outside of webdriver though, I can click the submit button and send the inputs but in webdriver, it doesn't seem do anything. Is this something wrong with webdriver?

Thanks.

Note: The selenium version is the latest 2.47.0 along with chrome and chromedriver. I can't provide the link to the webpage since its a private server. Here is the code for the button

<span id="button-1429-btnInnerEl" class="x-btn-inner x-btn-inner-center" unselectable="on">Submit All</span>

Upvotes: 4

Views: 8323

Answers (6)

AmitKS
AmitKS

Reputation: 162

You can use Action Class. Might be Button is in Displayed false.

IWebElement button = driver.FindElement(By.Id("submit")); // locate the button
Actions action = new Actions(driver);
action.MoveToElement(button).Click().Perform(); 

Upvotes: 0

rajpal yadav
rajpal yadav

Reputation: 1

You can try this:-

driver.findElement(By.xpath("//*[contains(text(),'Submit All')]")).click();

Upvotes: 0

Mayur Kodhe
Mayur Kodhe

Reputation: 31

Solution:-

step 1. import org.openqa.selenium.Keys;

step 2. driver.element.sendKeys(Keys.ENTER);

Upvotes: 1

Jaffar Ahamed
Jaffar Ahamed

Reputation: 21

It will solve, Here I'm using python language. First, you need to import Keys and the following code will help you.

from selenium.webdriver.common.keys import Keys
login_btn=driver.find_element_by_id('button-1429-btnInnerEl').send_keys(Keys.ENTER)

Upvotes: 2

danielepolencic
danielepolencic

Reputation: 5163

Having the same issue. Using element.sendKeys(Keys.ENTER) solves it for me.

Upvotes: 11

silhouette hustler
silhouette hustler

Reputation: 1763

Try to click it with javaScript:

var element = driver.FindElement(By.Xpath("//span[contains(@id, 'button-1429')]"));

 var js = (IJavaScriptExecutor) driver;
 js.ExecuteScript("arguments[0].click()", element);

Upvotes: 0

Related Questions