dane-tool / dane

🐳📡🐶 Generate network communication data for target tasks in diverse network conditions.
https://dane-tool.github.io/dane/
MIT License
4 stars 2 forks source link

How can we change firefox to chrome or install a local plugin with firefox. #19

Open Nikhilesh212 opened 3 years ago

parkeraddison commented 3 years ago

Discussed in https://github.com/dane-tool/dane/discussions/18

Originally posted by **Nikhilesh212** July 16, 2021 Hey, this is Nikhilesh from Viasat India. We are working on developing a video QoE for our network. We are using DANE to emulate Viasat like network, for that we need to integrate a chrome plugin with DANE, is there any way you could help us?

To use Google Chrome + ChromeDriver

You'll need to change the Docker image to install these rather than Firefox+Geckodriver. We'll need to change these lines: https://github.com/dane-tool/dane/blob/95b17038f8cfd18c09f097628657715862ece5fd/docker/client/Dockerfile#L22-L36

Here's an easy way of doing so:

# Install Google Chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
    apt-get update && \
    apt-get install ./google-chrome-stable_current_amd64.deb

# Install ChromeDriver
RUN wget https://chromedriver.storage.googleapis.com/$(curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip && \
    unzip chromedriver_linux64.zip -d /usr/local/bin/

(don't forget to run make build and set the .system.use_local_images field to true in the config file so that the new Docker image will be used!)

To use a Chrome extension

You'll need to download the extension as a .crx file and drop it in the same directory as your selenium script. Then in the script you can use

driver.add_extension(<path to extension .crx file>)

to load in the extension.

We did this over at dane-tool/starter-scripts for a Firefox addon -- the addon file is in extensions/ and the streaming/endless-youtube.py script gets the absolute path to the addon then installs it. If you place the extension in the same directory then you can avoid the need for .parent stuff.

Hope this helps.

Originally posted by @parkeraddison in https://github.com/dane-tool/dane/discussions/18#discussioncomment-1017386