Search code examples
pythonseleniumselenium-webdriverbokehchartify

Chartify: how to pass a Selenium WebDriver?


The following example should work, but it requires the selenium package (as I understand, under the hood chartify builds an interactive chart using the bokeh package and takes a screenshot with selenium)

import chartify

chartify.examples.plot_scatter()

The code above doesn't work because I can't configure a driver for Selenium, which is normally done similar to this:

from selenium import webdriver
 driver = webdriver.Chrome(executable_path=(my_path + '/chromedriver)')

How can I pass this driver object to chartify?


Solution

  • It looks like they have hardcoded the creation and configuration of the webdriver in a Chart method _initialize_webdriver.

    If you want something different than what they do, I think monkey-patching the Chart. _initialize_webdriver method to override it is the only current option. It might be worth opening a issue on their GH tracker to discuss adding the ability to customize webdriver creation.