0

I am having trouble getting started with the webdriver dart library. I was hoping for some simple examples. I do have the seleniumn server standalone running in the background. I am very new to dart and very experienced with ruby and watir-webdriver.

I was expecting something similar to the code below

import 'package:webdriver/webdriver.dart';

main() {
  var url = "http://google.com";
  var driver = new WebDriver();

  b = driver.newSession(browser:'firefox');

  b.getUrl(url);

}

But the error I am getting is

Unhandled exception:
No constructor 'WebDriver' declared in class 'WebDriver'.

Looking at the source

class WebDriver extends WebDriverBase {

  WebDriver(host, port, path) : super(host, port, path);

So it seems like the constructor is there; and the defaults are in the WebDriverBase to go to the remote server. What am I doing wrong? I have scoured the internet trying to find simple examples with no luck

3
  • 1
    Don't know anything about WebDriver, but from what I can see here, the constructor of WebDriver takes 3 (non-optional) arguments and you don't give it any. Commented Mar 24, 2013 at 1:07
  • You are correct. I thought the defaults in the parent class would be called if those arguments were not provided that's what I thought the call to super was for . Commented Mar 24, 2013 at 4:57
  • 1
    This code will actually launch a firefox browser but then I don't have a handle to a WebdriverSession instance in order to send messages. Not sure what else to do here.. oh well. And this dumb comment won't format correctly. Or It's just me. import 'package:webdriver/webdriver.dart'; main() { var driver = new WebDriver('localhost',4444,'/wd/hub').newSession('firefox'); driver.setUrl('http://google.com'); // driver is Instance of '_FutureImpl@0x2900bd4a' // instead of WebDriverSession // "Future<WebDriverSession>" has no method named "setUrl" } Commented Mar 24, 2013 at 21:34

1 Answer 1

1

Currently, there are known issues with local and session storage, script execution, and log access.

To use these bindings, the Selenium standalone server must be running. You can download it at http://code.google.com/p/selenium/downloads/list.

There are a number of commands that use ids to access page elements. These ids are not the HTML ids; they are opaque ids internal to WebDriver. To get the id for an element you would first need to do a search, get the results, and extract the WebDriver id from the returned Map using the 'ELEMENT' key. see http://commondatastorage.googleapis.com/dartlang-api-docs/13991/webdriver.html

Sign up to request clarification or add additional context in comments.

1 Comment

While this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.