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?
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. We're using ExtJS 4 and the XPATH that I used is //span[text()='Submit All']
. 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>
4 Answers 4
This Answer is based on Selenium Webdriver:
There are following reason to fail the script:
- When you open up page , Submit All button is not loaded in page
- Submit All button is not in visible area (or half visible). Note : selenium is only work with fully visible component
- You may have multiple button or element on page with
//span[text()='Submit All']
xapth - Your element is not clickable so
element.click();
is not working
Solution :
- For 1st point you should wait until page is not fully loaded.
- For 2nd scroll to the element or make button enable
- For 3rd select the button that you want (change in xpath)
- For 4rth check until element is clickable
Please let me know If any doubt.
Note : Provide your error/log so we can identify exact problem.
@ihossain, I have faced this issue and below solution works for me :
element.submit();
-
1This might work but not require the button to actually work so you might have a broken form button in a form that responds only to the enter key if at all.Michael Durrant– Michael Durrant2016年11月16日 23:54:50 +00:00Commented Nov 16, 2016 at 23:54
-
Submit() only works only when the type of your button element is submit. i.e <span id="button-1429-btnInnerEl" class="x-btn-inner x-btn-inner-center" type="submit" </span> I think in this scenario submit will not work, If he tried with java-executor definitely it will works. Let's try with java-executor for click action.2017年08月02日 12:28:26 +00:00Commented Aug 2, 2017 at 12:28
I have seen this before. For some complex reasons, some Javacript only works with real mouse clicks. The usual workaround is to add a tool like AHK, Kantu or Sikuli to your test suite. All the tools I mentioned send mouse clicks that are indistinguishable from real mouse clicks (unlike webdriver clicks)
I've faced the similar kind of issue. Have implemented a work around that to submit the form by invoking the code browser.submitForm(<locator of form>)
.
It solved the issue for me.
Explore related questions
See similar questions with these tags.
unselectable
which makes the element for Selenium. Try identifiing it via counting the element and not via directly accessing it.