Giter Site home page Giter Site logo

Comments (7)

danbaghilovici avatar danbaghilovici commented on May 12, 2024 3

Helium has two functions : set_driver() and get_driver(). You can use a new selenium driver with the given arguments options to start helium with that given driver. For example :

from helium import *
from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--incognito")
chrome_options.add_argument("--window-size=600,300")
# or max
# chrome_options.add_argument("--start-maximized")
driver = webdriver.Chrome("./chromedriver", options=chrome_options)
set_driver(driver)
get_driver()
go_to("google.com")

After calling set_driver() there is no need to call start_chrome() since set_driver() already starts the given driver. Hope it helped.
I will probably add a PR later for suggesting that start_chrome() or start_firefox() take extra arguments for setting the drivers.
EDIT : code format

from helium.

mherrmann avatar mherrmann commented on May 12, 2024

Thank you @dntzbgh! Re the pr: before you spend time on this, could you explain why it would be better than set_driver?

from helium.

danbaghilovici avatar danbaghilovici commented on May 12, 2024

I guess its more straightforward than creating the driver instance with selenium and then setting it up with set_driver(). It will be much easier just to pass the arguments into start_chrome(url, options).

from helium.

punasusi avatar punasusi commented on May 12, 2024

I don't think such a PR would give any technical benefits, but it would certainly be much more usable to just set any extra arguments directly in start_chrome(url, options).

from helium.

mherrmann avatar mherrmann commented on May 12, 2024

Yeah, makes sense. Do you think you could add it for start_firefox too @dntzbgh ?

from helium.

danbaghilovici avatar danbaghilovici commented on May 12, 2024

Hi, sorry for such a late response.
After thinking it better I think that what you have said in #9 makes sense. There are too many options and parameters to add it all one function and inserting it all in a webdriver.ChromeOptions object to the parameter wont help that much since if you have already configured an webdriver.ChromeOptions you might as well add it to a selenium driver and pass it to the set_driver() function. This way you have more flexibility with initialization of the driver parameters.

from helium.

mherrmann avatar mherrmann commented on May 12, 2024

I've added an options parameter to start_chrome now. Please see release 3.0.2.

from helium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.