0

I'm trying to use the following code to disable form validation using JavaScript which isn't working:

     ((JavascriptExecutor) webDriver).executeScript("document.getElementById('node-event-form').noValidate = true;");

Whereas the command document.getElementById('node-event-form').noValidate = true; works in the console. I've verified this on Chrome and Firefox latest versions.

Does anybody know what I could be doing wrong?

avi
  • 1,847
  • 3
  • 16
  • 17
  • Seems your automating and want to stop form validaton using selenium? – brk Dec 24 '15 at 03:04
  • Yes, thats right. I'm automating to validate server side error messages for our application but with HTML 5 this validation happens at the client side itself. So, in order to validate the server response I would need to stop this validation at the client side. w3school's page (http://www.w3schools.com/jsref/prop_form_novalidate.asp) says that it is achievable using noValidate method in html5. which actually works fine when used via console, but for some reason I just can't get it to work with WebDriver. – avi Dec 24 '15 at 05:47

0 Answers0