{"id":14978914,"url":"https://github.com/flu-x/flexibox","last_synced_at":"2025-10-28T14:30:38.161Z","repository":{"id":57431331,"uuid":"136049769","full_name":"flu-x/flexibox","owner":"flu-x","description":"One single end point to get started with your selenium codebase in a go","archived":false,"fork":false,"pushed_at":"2020-08-19T04:26:17.000Z","size":393,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T02:54:56.883Z","etag":null,"topics":["browser-drivers","chromedriver","driver","geckodriver","problem-statement","pytest","python37","selenium","selenium-webdriver","unit-test","unit-testing","webdriver"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flu-x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-04T16:00:58.000Z","updated_at":"2021-10-31T06:52:07.000Z","dependencies_parsed_at":"2022-09-02T11:51:18.548Z","dependency_job_id":null,"html_url":"https://github.com/flu-x/flexibox","commit_stats":null,"previous_names":[],"tags_count":10,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flu-x%2Fflexibox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flu-x%2Fflexibox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flu-x%2Fflexibox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flu-x%2Fflexibox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flu-x","download_url":"https://codeload.github.com/flu-x/flexibox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238662633,"owners_count":19509639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-drivers","chromedriver","driver","geckodriver","problem-statement","pytest","python37","selenium","selenium-webdriver","unit-test","unit-testing","webdriver"],"created_at":"2024-09-24T13:58:37.549Z","updated_at":"2025-10-28T14:30:37.784Z","avatar_url":"https://github.com/flu-x.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flexibox\n\n![Flexibox logo](https://live.staticflickr.com/65535/50236270473_9e9e3bfce5.png)\n\n**Flexibox** is the a selenium wrapper for all **browsers** and **browser** **configurations**. This module is a single end point to access all the browser drivers and as well as the webdriver object for all the respective browsers along with the installation of your **selenium** module.\n\n## Problem Statement\nWith the very fast pace of development, it has now become very important to have regular release cycle and with it it should be also kept in mind that we do a quality release. For this reason we have to have our tests automated as well so that we can have a centralised reports for regressions and other flaws in the system at the end of each build.\n\nNow, for a stable build we have to check that our application is compatible with different browsers and platforms. When we start implementing a framework based out of Selenium WebDriver, for the code to get executed in different browsers we have to configure each of the browsers separately and make a call to the browser based on the requirement. Phewww !! That is some good amount of code written.\n\n## The Idea\nThe problem statement that has been defined above was the reason I took out time to ease this entire process of setting up the browser drivers and the respective configurations for each browser. What if this process can be reduced down into few steps of execution? That is how I ended up with the idea and the implementation of **Flexibox**.\n\n## Features covered up by 'Flexibox'\n*   One step to **download** the required browser drivers.\n*   One step to **update** the required browser drivers.\n*   Create a **single** **instance** for your required browser object. No more code required to configure your browsers separately.\n*   A set of browser related **generic** **functions** that can be utilised for debugging as well as for achieving the required functionalities. So, we are reducing quite an effort over here as well !!\n*   You can run browsers **Chrome** and **Firefox** using the **headless** option as well so that it is comfortable running your framework on the server as well.\n\n## Flexibox by functionality\n![functionality screenshot](https://farm2.staticflickr.com/1750/41853754714_971a727962.jpg)\n\nThere are two ways in which you can use Flexibox.\n\n*   Download the required browser driver, create instance for the specific browser driver class.\n*   Download the required browser driver, create instance for the specific browser driver class, create instance for the browser controller class and use the generic functions to get started with your framework.\n\nYou can refer to the above diagram for reference.\n\n## Installing and Updating driver packages\n\n### Install Flexibox module\n*   To install Flexibox using PiP run the command:\n\n\t   ```python\n\t   pip install flexibox\n\t   ```\n\n*   To install Flexibox from GitHub run the command:\n\n\t   ```python\n\t   pip install git+git://github.com/flexibox/Flexibox.git\n\t   ```\n\n### Modules installed with flexibox\n*   **requests**\n*   **selenium**\n*   **wget**\n\nMake sure you have **ssh** configured in GitHub. You can also use **https** as well to install the module. But preferrable would be if you have **ssh** configured in GitHub.\n\nTo install Flexibox from GitHub using HTTPS run the command:\n\n```python\npip install git+https://github.com/flexibox/Flexibox.git\n```\n\n*   To download chromedriver run the command\n\n\t   ```bash\n\t   flexibox download --driver=chromedriver\n\t   ```\n\n*   To download geckodriver run the command\n\n\t   ```bash\n\t   flexibox download --driver=geckodriver\n\t   ```\n\n*   To download operadriver run the command\n\n\t   ```bash\n\t   flexibox download --driver=operadriver\n\t   ```\n\n### Update Drivers\n*   To update chromedriver run the command\n\n\t   ```bash\n\t   flexibox update --driver=chromedriver\n\t   ```\n\n*   To update geckodriver run the command\n\n\t   ```bash\n\t   flexibox update --driver=geckodriver\n\t   ```\n\n*   To update operadriver run the command\n\n\t   ```bash\n\t   flexibox update --driver=operadriver\n\t   ```\n\n## Get started with Flexibox\n### Browser Controller class by functionality\nThe `Browser Controller` class provides you with some eccentric methods that can be utilised to achieve the required functions.\n\n*      get_url(driver, url): request the required url entered. Pass the required driver object and the 'url' as parameters.\n\n*      implicit_wait_time(driver, time): Apply implicit wait before the dom loads. Pass the required driver object and the time as parameters.\n\n*      set_window_size(driver, height, width): Set the window size for the current running browser. Pass the required driver object, height and the width of the window.\n\n*      get_current_url(driver): Get the current url. Pass the required driver object as parameter.\n\n*      get_network_requests(driver): Get all the network requests for the current page. Pass the required driver object as parameter.\n\n*      performance_metrics(driver): Get required page performance data. Pass the required driver object as parameter.\n\n*      check_console_logs(driver): Get all console logs. Pass the required driver object as parameter.\n\n*      get_page_source(driver): Get the current page source. Pass the required driver object as parameter.\n\n*      get_site_cookies(driver): Get all the site cookies. Pass the required driver object as parameter.\n\n### Create instance for Chrome\n*      Create instance for the `ChromeDriverObject` class\n*      Use the instance for `ChromeDriverObject` class to call the `set_chromedriver_object` method.\n*      Create instance for the `Browser_controller` class to use the generic methods.\n\n```python\n\tfrom flexibox.generic_functions.chrome_object import ChromeDriverObject\n\tfrom flexibox.generic_functions.browser_controller import Browser_controller\n\tfrom time import sleep\n\n\tclass Test_1():\n\t\tdef test_chromedriver_type1(self):\n\t\t\tchromedriver = ChromeDriverObject()\n\t\t\tcontroller = Browser_controller()\n\t\t\tdriver = chromedriver.set_chromedriver_object()\n\t\t\tcontroller.get_url(driver, \"https://www.google.co.in\")\n\t\t\tcontroller.implicit_wait_time(driver, 4)\n\t\t\tcurrent_url = controller.get_current_url(driver)\n\t\t\tprint current_url\n```\n*      To run chromedriver using the `headless` feature you have to pass the argument '--headless' in the `set_chromedriver_object()` method\n\n```python\n\tfrom flexibox.generic_functions.chrome_object import ChromeDriverObject\n\tfrom flexibox.generic_functions.browser_controller import Browser_controller\n\tclass Test_1():\n\t\tdef test_chromedriver_type1(self):\n\t\t\tchromedriver = ChromeDriverObject()\n\t\t\tcontroller = Browser_controller()\n\t\t\tdriver = chromedriver.set_chromedriver_object('--headless')\n\t\t\tcontroller.get_url(driver, \"https://www.google.co.in\")\n\t\t\tcontroller.implicit_wait_time(driver, 4)\n\t\t\tcurrent_url = controller.get_current_url(driver)\n\t\t\tprint current_url\n```\n\n### Create instance for Firefox\n*   Create instance for the `GeckoDriverObject` class\n*   Use the instance for `GeckoDriverObject` class to call the `set_geckodriver_object` method.\n*   Create instance for the `Browser_controller` class to use the generic methods.\n\n```python\n\tfrom flexibox.generic_functions.gecko_object import GeckoDriverObject\n\tfrom flexibox.generic_functions.browser_controller import Browser_controller\n\tclass Test1():\n\t\tdef test_geckodriver_type1(self):\n\t\t\tgeckodriver = GeckoDriverObject()\n\t\t\tcontroller = Browser_controller()\n\t\t\tdriver = geckodriver.set_geckodriver_object()\n\t\t\tcontroller.implicit_wait_time(driver, 4)\n\t\t\tcontroller.get_url(driver, \"https://www.google.co.in\")\n\t\t\tcurrent_url = controller.get_current_url(driver)\n\t\t\tprint current_url\n\t\t\tprint driver.title\n```\n*  To run geckodriver using the `headless` feature you have to pass the argument '--headless' in the `set_geckodriver_object()` method\n\n```python\n\tfrom flexibox.generic_functions.gecko_object import GeckoDriverObject\n\tfrom flexibox.generic_functions.browser_controller import Browser_controller\n\tclass Test1():\n\t\tdef test_geckodriver_type1(self):\n\t\t\tgeckodriver = GeckoDriverObject()\n\t\t\tcontroller = Browser_controller()\n\t\t\tdriver = geckodriver.set_geckodriver_object('--headless')\n\t\t\tcontroller.implicit_wait_time(driver, 4)\n\t\t\tcontroller.get_url(driver, \"https://www.google.co.in\")\n\t\t\tcurrent_url = controller.get_current_url(driver)\n\t\t\tprint current_url\n\t\t\tprint driver.title\n```\n\n### Create instance for Opera\n*   Create instance for the `OperaDriverObject` class\n*   Use the instance for `OperaDriverObject` class to call the `set_operadriver_object` method\n*   Create instance for the `Browser_controller` class to use the generic methods.\n\n```python\n\tfrom flexibox.generic_functions.opera_object import OperaDriverObject\n\tfrom flexibox.generic_functions.browser_controller import Browser_controller\n\tclass Test1():\n\t\tdef test_operadriver_type1(self):\n\t\t\toperadriver = OperaDriverObject()\n\t\t\tcontroller = Browser_controller()\n\t\t\tdriver = operadriver.set_operadriver_object()\n\t\t\tcontroller.implicit_wait_time(driver, 4)\n\t\t\tcontroller.get_url(driver, \"https://www.google.co.in\")\n\t\t\tcurrent_url = controller.get_current_url(driver)\n\t\t\tprint current_url\n\t\t\tprint driver.title\n```\n\n### Create instance for Safari\n*   Create instance for the `SafariDriverObject` class\n*   Use the instance for `SafariDriverObject` class to call the `set_safaridriver_object` method\n*   Create instance for the `Browser_controller` class to use the generic methods.\n\n```python\n\tfrom flexibox.generic_functions.safari_object import SafariDriverObject\n\tfrom flexibox.generic_functions.browser_controller import Browser_controller\n\tclass Test_1():\n\t\tdef test_safaridriver_type1(self):\n\t\t\tsafaridriver = SafariDriverObject()\n\t\t\tcontroller = Browser_controller()\n\t\t\tdriver = safaridriver.set_safaridriver_object()\n\t\t\tcontroller.get_url(driver, \"https://www.google.co.in\")\n\t\t\tcontroller.implicit_wait_time(driver, 4)\n\t\t\tcurrent_url = controller.get_current_url(driver)\n\t\t\tprint current_url\n\t\t\tprint driver.title\n\t\t\tdriver.quit()\n```\nP.S: Safaridriver comes shipped with the Safari browser by default. You have to enable the `Allow Remote Automation` option from the `Develop` menu. Please check this screenshot.\n![Safari](https://farm2.staticflickr.com/1738/28757957868_38fff165d4.jpg)\n\nKeep in mind that your safari version has to be more than 10. If it is not 10 or more than 10 then please update your Safari version.\n\n### Deleting all browser driver\nTo delete all browser drivers from `/usr/local/bin` run the command:\n\n   ```bash\n   flexibox delete --driver=all\n   ```\n\n## Running flexibox using grid\nUse the docker containers for selenium grid to start the docker services using the following instructions:\n\n### For running Docker Hub\n```bash\n$ docker run -p 4444:4444 --name selenium-hub selenium/hub\n# Run the hub, forwarding the \"4444\" port from the docker container to the host machine.\n```\n\n### For running the CHROME node\n```bash\n$ docker run --link selenium-hub:hub selenium/node-chrome\n# Run the chrome node and link it to the `--name` we specified for the hub.\n```\n\n### For running the FIREFOX node\n```bash\n$ docker run --link selenium-hub:hub selenium/node-firefox\n# Run the firefox node and link it to the `--name` we specified for the hub.\n```\n\n### Running flexibox for chrome node\n```python\nimport unittest\n\nfrom flexibox.core.browser_controller import BrowserController\nfrom flexibox.generic_functions.remotechrome_object import RemotechromedriverObject\n\n\nclass Test_chromeremote(unittest.TestCase):\n    def test_chromedriver_type_remote(self):\n        chromedriver = RemotechromedriverObject()\n        controller = BrowserController()\n        driver = chromedriver.set_remote_chromedriver_object(\"http://localhost:4444/wd/hub\")\n        controller.get_url(driver, \"https://www.google.co.in\")\n        controller.implicit_wait_time(driver, 4)\n        current_url = controller.get_current_url(driver)\n        print(current_url)\n        controller.tear_browser(driver)\n\n```\n\n### Running flexibox for firefox node\n```python\nimport unittest\n\nfrom flexibox.core.browser_controller import BrowserController\nfrom flexibox.generic_functions.remotegecko_object import RemotegeckodriverObject\n\n\nclass Test_firefoxremote(unittest.TestCase):\n    def test_firefox_type_remote(self):\n        firefoxdriver = RemotegeckodriverObject()\n        controller = BrowserController()\n        driver = firefoxdriver.set_remote_geckodriver_object(\"http://localhost:4444/wd/hub\")\n        controller.get_url(driver, \"https://www.google.co.in\")\n        controller.implicit_wait_time(driver, 4)\n        current_url = controller.get_current_url(driver)\n        print(current_url)\n        controller.tear_browser(driver)\n```\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1d8f7a6f46bc4182992b04c7f9b51447)](https://www.codacy.com/app/Corefinder89/Flexibox?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=flexibox/Flexibox\u0026amp;utm_campaign=Badge_Grade)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflu-x%2Fflexibox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflu-x%2Fflexibox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflu-x%2Fflexibox/lists"}