Skip to content
/ wdc Public

A Go client library for accessing a remote webdriver session and perform page inspections.

License

Notifications You must be signed in to change notification settings

codedius/wdc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go WebDriver Remote Client

A Go client library for accessing a remote webdriver session and perform page inspections. Partially (see the full list of implemented members in the doc) complies W3C specifications. Library is intended to be as simple as possible and not claiming to be full-fledged webdriver client. If you’re looking for that kind of client you may try another awsome project selenium-go.

Installation

Use the following command to download this module:

go get github.com/codedius/wdc

Usage

import "github.com/codedius/wdc"

Construct a new client:

sess := wdc.Session{
    ID:  "ba97d362c7880e1adc7b81e613c665c6",   // webdriver session ID
    URL: "http://example.com",  	       // webdriver remote server URL
}

client, err := wdc.New(&sess)
if err != nil {
    // error handling
}

Perform inspections. For example:

ctx := context.Background()

// navigate to the page
err = client.NavigateTo(ctx, "http://example.com") 
if err != nil {
    // error handling
}

// set timeout to find the element
err = client.TimeoutElementFind(ctx, 10*time.Second)
if err != nil {
    // error handling
}

// get element's ID to perform further inspections
eid, err := client.ElementFind(ctx, wdc.ByXPath, "//div[@class='my-class']")
if err != nil {
    // error handling
}
	
// get element's text
text, err := client.ElementText(ctx, eid)
if err != nil {
    // error handling
}

About

A Go client library for accessing a remote webdriver session and perform page inspections.

Resources

License

Stars

Watchers

Forks

Languages