unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Luis Felipe <luis.felipe.la@protonmail.com>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: help-guix <help-guix@gnu.org>
Subject: Re: Using IceCat/geckodriver with Selenium (Python)
Date: Fri, 05 Nov 2021 22:19:33 +0000	[thread overview]
Message-ID: <eRqAkNZLFG7_INhoeR2e6gLQ8j9yd5E2n2BLI-oII4TJN1uXsXTeaBZfwIq7982IpI8IOrQKFZJu0vySo5g_h5r152_bNlho48YITyusIFc=@protonmail.com> (raw)
In-Reply-To: <87mtmi30c1.fsf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1645 bytes --]

Hi, Maxim :)

On Friday, November 5th, 2021 at 6:48 PM, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

> Hello,
> 

> I'm sharing this bit of knowledge as it was not obvious at all.
> 

> Selenium is hard-coded to look for 'firefox' in a couple places, even in
> 

> the serialized settings it sends to the browser instance controlled by
> 

> geckodriver.
> 

> Here's the initialization that worked using Guix on the
> 

> core-updates-frozen-batched-changes branch (where 'geckodriver' was
> 

> recently added to IceCat):
> 

> --8<---------------cut here---------------start------------->8---
> 

> from selenium.webdriver import Firefox, FirefoxOptions
> 

> Monkey patch the KEY string for IceCat.
> =======================================
> 

> FirefoxOptions.KEY = "moz:icecatOptions"
> 

> options = FirefoxOptions()
> 

> options.headless = False
> 

> options.binary = 'icecat'
> 

> options.set_capability('browserName', 'icecat')
> 

> self.driver = Firefox(options=options)# TODO:
> 

> --8<---------------cut here---------------end--------------->8---
> 

> The non-obvious was monkey patching the 'moz:icecatOptions' string of
> 

> the FirefoxOptions object, and having to set the 'browserName'
> 

> capability; otherwise a capability/invalid argument execption would be
> 

> raised.

Thanks, good to know about the options and that geckodriver is there now. 



> If you use chromedriver (included with) our ungoogled-chromium instead,
> 

> it is more straightforward as there is nothing to rename/monkey patch:

Yeah, this one just works.

[-- Attachment #1.2: publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc --]
[-- Type: application/pgp-keys, Size: 1815 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 509 bytes --]

      reply	other threads:[~2021-11-05 22:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 18:48 Using IceCat/geckodriver with Selenium (Python) Maxim Cournoyer
2021-11-05 22:19 ` Luis Felipe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='eRqAkNZLFG7_INhoeR2e6gLQ8j9yd5E2n2BLI-oII4TJN1uXsXTeaBZfwIq7982IpI8IOrQKFZJu0vySo5g_h5r152_bNlho48YITyusIFc=@protonmail.com' \
    --to=luis.felipe.la@protonmail.com \
    --cc=help-guix@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).