Skip to content

Commit

Permalink
Define PageSource (bazelbuild#198)
Browse files Browse the repository at this point in the history
PageSource returns the source of the current browsing context active document.
  • Loading branch information
joshbruning authored and DrMarcII committed Jan 22, 2018
1 parent 1d66da0 commit 980c8ab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions go/launcher/webdriver/webdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ type WebDriver interface {
W3C() bool
// CurrentURL returns the URL that the current browser window is looking at.
CurrentURL(context.Context) (*url.URL, error)
// PageSource returns the source of the current browsing context active document.
PageSource(context.Context) (string, error)
// NavigateTo navigates the controlled browser to the specified URL.
NavigateTo(context.Context, *url.URL) error
}
Expand Down Expand Up @@ -362,6 +364,16 @@ func (d *webDriver) CurrentURL(ctx context.Context) (*url.URL, error) {
return current, nil
}

// PageSource returns the source of the current browsing context active document.
func (d *webDriver) PageSource(ctx context.Context) (string, error) {
var result string

if err := d.get(ctx, "source", &result); err != nil {
return "", err
}
return result, nil
}

// NavigateTo navigates the controlled browser to the specified URL.
func (d *webDriver) NavigateTo(ctx context.Context, u *url.URL) error {
return d.post(ctx, "url", map[string]interface{}{
Expand Down

0 comments on commit 980c8ab

Please sign in to comment.