Browser not launching at all using selenium java -
desiredcapabilities capabilities = desiredcapabilities.chrome(); chromeoptions options = new chromeoptions(); options.addarguments(arrays.aslist("--start-maximized", "allow-running- insecure-content", "ignore-certificate-errors")); capabilities.setcapability(chromeoptions.capability, options); webdriver webdriver = new remotewebdriver(new url("http://www.google.com"), capabilities);
webdriver.findelement.....
i have above piece of code start browser , go url. did 1. brew install chromedriver 2. made sure /usr/local/bin in path variable. 3. when run above peice of code fails in find element giving null pointer exception. running mac os.. how can fix problem. did lot of work arounds, same code without capabilities , giving chromedriver path working before.. not sure why not able run..
there 2 solutions problem:
make sure want use remotewebdriver. if want set selenium grid chrome node. won't describe how set here, easy set local grid+nodes using docker: https://github.com/seleniumhq/docker-selenium if use this, need change driver (assuming grid on localhost):
string huburl = "http://localhost:4444/wd/hub"; webdriver webdriver = remotewebdriver(new url(huburl), capabilities);
or use chromedriver class instead of remotewebdriver:
webdriver webdriver = new chromedriver(capabilities);
finally, go webpage, you'll need use get
method on driver:
webdriver.get(url);
Comments
Post a Comment