1

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>
  • What code you used for submitting the input? Can you provide that code? – Dhiman Aug 6 '15 at 23:20
  • I'm doing a .click() on the xpath shown above – ihossain Aug 7 '15 at 1:28
  • Maybe a duplicate of this: sqa.stackexchange.com/questions/8371/… . The problem is the unselectable which makes the element for Selenium. Try identifiing it via counting the element and not via directly accessing it. – bish Aug 7 '15 at 4:50
  • @bish, I think that is definitely the problem but I used JavaScript Executor and it doesn't work. Thanks though, do you think there may be another solution? – ihossain Aug 7 '15 at 18:13
  • As you face a problem even manually clicking a button when a browser is started from webdriver, then it is likely connected with browser capabilities which are set up by your driver. You might have javascript disabled. Check how you start you browser. – Alexey R. Sep 1 '17 at 13:38
1

This Answer is based on Selenium Webdriver:

There are following reason to fail the script:

  1. When you open up page , Submit All button is not loaded in page
  2. Submit All button is not in visible area (or half visible). Note : selenium is only work with fully visible component
  3. You may have multiple button or element on page with //span[text()='Submit All'] xapth
  4. 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.

0

@ihossain, I have faced this issue and below solution works for me :

element.submit();
  • 1
    This 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 Nov 16 '16 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. – Bharat Mane Aug 2 '17 at 12:28
0

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)

-1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.