javascript - I can't get selenium-webdriver with chromedriver working on Mac OSX -


i'm trying functional testing using selenium-webdriver in google chrome navigator on mac osx, have problems while trying interact navigator.

i've simplified problem similar one: need open google main page , write in input, execute node script:

require('chromedriver');  var webdriver = require('selenium-webdriver'),     = webdriver.by,     until = webdriver.until;  var driver = new webdriver.builder()     .forbrowser('chrome')     .build();  driver.get('http://www.google.com/ncr'); driver.findelement(by.name('q')).sendkeys('webdriver'); 

the npm dependencies are:

npm install selenium-webdriver chromedriver 

the results of execution are: google chrome browser opens (so chromedriver seems work), input field isn't written, because the call never finishes executing. browser can load given web page after can't interact it.

of course, i've tried download , install manually chromedriver, locating binary file in /usr/local/bin , chmod +x it, result same.

however, if try same in safari (removing first require line , using 'safari' browser instead of 'chrome') works! need test in google chrome!

also, have tryied same example using java , google chrome, , works! it's problem related selenium webdriver javascript implementation? or integration chromedriver...?

webdriverjs uses promises in order make dealing async code. take here more in-depth clarification / example: http://www.codechewing.com/library/beginners-guide-to-selenium-webdriverjs/

driver.get('http://www.google.com/ncr');  driver.findelement({name: 'q'}).then(function(input) {   input.sendkeys('webdriver');   input.sendkeys(webdriver.key.enter); }); 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -