func NewDriver(capabilities Capabilities, urlPrefix string, mjpegPort ...int) (driver WebDriver, err error) {
	if len(mjpegPort) == 0 {
		mjpegPort = []int{9100}
	}
	wd := new(remoteWD)
	if wd.urlPrefix, err = url.Parse(urlPrefix); err != nil {
		return nil, err
	}
	var sessionInfo SessionInfo
	if sessionInfo, err = wd.NewSession(capabilities); err != nil {
		return nil, err
	}
	wd.sessionId = sessionInfo.SessionId
	var conn net.Conn
	if conn, err = net.Dial("tcp", fmt.Sprintf("%s:%d", wd.urlPrefix.Hostname(), mjpegPort[0])); err != nil {
		return nil, err
	}
	wd.mjpegClient = convertToHTTPClient(conn)
	return wd, nil
}
NewDriver creates new remote client, this will also start a new session.
package gwda
import (
	"bytes"
	"encoding/base64"
	"encoding/json"
	"errors"
	"fmt"
	giDevice "github.com/electricbubble/gidevice"
	"net"
	"net/http"
	"net/url"
	"path"
	"strings"
	"sync"
	"time"
)