kopia lustrzana https://github.com/browsh-org/browsh
Update FF Marionette commands
In Firefox 63 an old syntax for Marionette commands was deprecated. Updating mostly just meant prepending `WebDriver` to existing commands. This should fix most problems in #232pull/261/head
rodzic
2afe57b02f
commit
aedcdb388f
|
@ -5,7 +5,7 @@ go:
|
|||
|
||||
addons:
|
||||
# Use the full version number with ".0" if needed. This value is scraped by setup scripts.
|
||||
firefox: "60.0"
|
||||
firefox: "63.0"
|
||||
apt:
|
||||
packages:
|
||||
- rpm
|
||||
|
|
|
@ -36,7 +36,7 @@ is running somewhere else on mains electricity.
|
|||
## Installation
|
||||
|
||||
Download a binary from the [releases](https://github.com/browsh-org/browsh/releases) (~7MB).
|
||||
You will need to have [Firefox 57](https://www.mozilla.org/en-US/firefox/new/) (or higher) aleady installed.
|
||||
You will need to have [Firefox 63](https://www.mozilla.org/en-US/firefox/new/) (or higher) aleady installed.
|
||||
|
||||
Or download and run the Docker image (~230MB) with:
|
||||
`docker run --rm -it browsh/browsh`
|
||||
|
|
|
@ -214,7 +214,7 @@ func firefoxMarionette() {
|
|||
}
|
||||
marionette = conn
|
||||
readMarionette()
|
||||
sendFirefoxCommand("newSession", map[string]interface{}{})
|
||||
sendFirefoxCommand("WebDriver:NewSession", map[string]interface{}{})
|
||||
}
|
||||
|
||||
// Install the Browsh extension that was bundled with `go-bindata` under
|
||||
|
@ -228,20 +228,20 @@ func installWebextension() {
|
|||
defer os.Remove(file.Name())
|
||||
ioutil.WriteFile(file.Name(), []byte(data), 0644)
|
||||
args := map[string]interface{}{"path": file.Name()}
|
||||
sendFirefoxCommand("addon:install", args)
|
||||
sendFirefoxCommand("Addon:Install", args)
|
||||
}
|
||||
|
||||
// Set a Firefox preference as you would in `about:config`
|
||||
// `value` needs to be supplied with quotes if it's to be used as a JS string
|
||||
func setFFPreference(key string, value string) {
|
||||
sendFirefoxCommand("setContext", map[string]interface{}{"value": "chrome"})
|
||||
sendFirefoxCommand("Marionette:SetContext", map[string]interface{}{"value": "chrome"})
|
||||
script := fmt.Sprintf(`
|
||||
Components.utils.import("resource://gre/modules/Preferences.jsm");
|
||||
prefs = new Preferences({defaultBranch: false});
|
||||
prefs.set("%s", %s);`, key, value)
|
||||
args := map[string]interface{}{"script": script}
|
||||
sendFirefoxCommand("executeScript", args)
|
||||
sendFirefoxCommand("setContext", map[string]interface{}{"value": "content"})
|
||||
sendFirefoxCommand("WebDriver:ExecuteScript", args)
|
||||
sendFirefoxCommand("Marionette:SetContext", map[string]interface{}{"value": "content"})
|
||||
}
|
||||
|
||||
// Consume output from Marionette, we don't do anything with it. It"s just
|
||||
|
@ -309,5 +309,5 @@ func startFirefox() {
|
|||
}
|
||||
|
||||
func quitFirefox() {
|
||||
sendFirefoxCommand("quitApplication", map[string]interface{}{})
|
||||
sendFirefoxCommand("Marionette:Quit", map[string]interface{}{})
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue