NAME
Brownie::Driver - base class of Brownie::Driver series
METHODS
new(%args)Returns a new instance.
my $driver = Brownie::Driver->new(%args);browserReturns a driver specific browser object.
my $browser = $driver->browser;visit($url)Go to $url.
$driver->visit('http://example.com/');current_urlReturns current page's URL.
my $url = $driver->current_url;current_pathReturns current page's path of URL.
my $path = $driver->current_path;status_codeReturns last request's HTTP status code.
my $code = $driver->status_code;response_headersReturns last request's HTTP response headers HTTP::Headers.
my $headers = $driver->response_headers;titleReturns current page's <title> text.
my $title = $driver->title;sourceReturns current page's HTML source.
my $source = $driver->source;documentReturns current page's HTML root element.
my $element = $driver->document;screenshot($filename)Takes current page's screenshot and saves to $filename as PNG.
$driver->screenshot($filename);execute_script($javascript)Executes snippet of JavaScript into current page.
$driver->execute_script('$("body").empty()');evaluate_script($javascript)Executes snipptes and returns result.
my $result = $driver->evaluate_script('1 + 2');If specified DOM element, it returns WebElement object.
my $node = $driver->evaluate_script('document.getElementById("foo")');find($locator, %args)Find an element on the page, and return Brownie::Node object.
my $element = $driver->find($locator, %args)$locatoris string of "CSS Selector" (e.g. "#id") or "XPath" (e.g. "//a[1]").%argsare:-base: Brownie::Node object where you want to start findingmy $parent = $driver->find('#where_to_parent'); my $child = $driver->find('a', base => $parent);
all($locator, %args)Find all elements on the page, and return Brownie::Node object list.
my @elements = $driver->all($locator, %args)$locatoris string of "CSS Selector" (e.g. "#id") or "XPath" (e.g. "//a[1]").%argsare:-base: Brownie::Node object where you want to start findingmy $parent = $driver->find('#where_to_parent'); my @children = $driver->all('li', base => $parent);
AUTHOR
NAKAGAWA Masaki <masaki@cpan.org>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.