seleniumtabs


Nameseleniumtabs JSON
Version 0.5.7 PyPI version JSON
download
home_pagehttps://github.com/TheConfused/selenium-tabs
SummarySelenium with tab management in Python
upload_time2024-09-10 15:58:22
maintainerNone
docs_urlNone
authorVishal Kumar Mishra
requires_python<4.0,>=3.10
licenseMIT
keywords selenium tabs selenium python selenium python automation python automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Selenium Tabs: Enhanced Tab Management for Selenium

Simplify your web automation tasks with **Selenium Tabs**, a Python package that takes Selenium to the next level with streamlined tab management and additional features.

### Installation

Install **Selenium Tabs** from PyPI with ease:

```bash
pip install seleniumtabs
```

### Core Idea

In **Selenium Tabs**, a `browser` contains multiple `tabs`, enabling you to interact with web pages more efficiently. You can perform various actions on both `Tab` and `Browser` objects, making web automation a breeze.

**Actions/Activities on `Tab` Objects:**
- Check tab status (open/closed)
- Switch to a specific tab
- Close a tab
- Access page source, title, and headings
- Select elements and perform actions using Jquery
- Perform actions on a specific tab (e.g., click, scroll, close)
- CSS selection made easy

**Actions/Activities on `Browser` Objects:**
- Open new tabs with URLs
- Retrieve a list of open tabs
- Switch to a specific tab (first, last, or any)
- Close a tab
- Close the entire browser

### Working with Driver Objects

A `driver` object is available on any `Tab` object,
allowing you to access the browser/driver object
and use Selenium methods when needed without making explicit switches to a specific tab.

### Features

**Selenium Tabs** offers a range of features to enhance your web automation tasks:
- Effortless tab management
- Seamless tab switching
- Real-time tab status tracking
- Convenient tab closure
- Built-in functions for scrolling, clicking, waiting for conditions, finding and more
- Access to the underlying Selenium `driver` object for advanced usage
- Access `driver` methods directly on tabs
- Automatic User agent selection based on set browser
- Basic steps to avoid getting flagged as an automation script by websites
- Use the all-powerful `pyquery` object access on each tab
- Execute jquery functions using `.jq` or `.jquery` attributes

### Usage

To get started with **Selenium Tabs**, create a `Browser` object and open tabs using the `open` method:

#### Browser

Create a `Browser` object, specifying the browser name (e.g. "Chrome" or "FireFox").
The project automatically downloads drivers.

```python
from seleniumtabs import Browser, Tab


with Browser(name="Chrome", implicit_wait=10) as browser:
    google = browser.open("https://google.com")
    yahoo = browser.open("https://yahoo.com")
    bing = browser.open("https://bing.com")
    duck_duck = browser.open("https://duckduckgo.com/")

    # Scroll on the page (example)
    yahoo.scroll(times=2)
    yahoo.scroll_to_bottom()

    # Working with tabs
    for tab in browser.tabs:
        print(tab)

    print(browser.tabs)
    print(browser.current_tab)

    # Selecting elements with JQuery (using browserjquery package)
    print(yahoo.jq("a"))

    # Selecting using CSS Selectors (no JQuery needed)
    for item in yahoo.css(".stream-items"):
        for a in item.css("a"):
            print(a, a.text)

    # Some `Tab` attributes/properties
    print(google.title)
    print(google.url)
    print(google.page_source)

    # Closing a tab
    bing.close() # Or browser.close_tab(bing)

    # Switching to a tab
    yahoo.switch()
    google.switch()

    # Accessing the driver object
    print(google.driver.title, google.title) # Should output same value

    # Directly access driver methods and attributes
    print(google.current_window_handle, google.tab_handle)
    google.refresh()

    # PyQuery
    print(google.pyquery.text())
    print(google.pq.size())
```

### TODO

- Complete documentation

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/TheConfused/selenium-tabs",
    "name": "seleniumtabs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "selenium tabs, selenium python, selenium python automation, python automation",
    "author": "Vishal Kumar Mishra",
    "author_email": "vishal.k.mishra2@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c0/bb/1f3ef48f588a7450b075e574608fda9eb680820e6c8084ee7a4ff58410d7/seleniumtabs-0.5.7.tar.gz",
    "platform": null,
    "description": "# Selenium Tabs: Enhanced Tab Management for Selenium\n\nSimplify your web automation tasks with **Selenium Tabs**, a Python package that takes Selenium to the next level with streamlined tab management and additional features.\n\n### Installation\n\nInstall **Selenium Tabs** from PyPI with ease:\n\n```bash\npip install seleniumtabs\n```\n\n### Core Idea\n\nIn **Selenium Tabs**, a `browser` contains multiple `tabs`, enabling you to interact with web pages more efficiently. You can perform various actions on both `Tab` and `Browser` objects, making web automation a breeze.\n\n**Actions/Activities on `Tab` Objects:**\n- Check tab status (open/closed)\n- Switch to a specific tab\n- Close a tab\n- Access page source, title, and headings\n- Select elements and perform actions using Jquery\n- Perform actions on a specific tab (e.g., click, scroll, close)\n- CSS selection made easy\n\n**Actions/Activities on `Browser` Objects:**\n- Open new tabs with URLs\n- Retrieve a list of open tabs\n- Switch to a specific tab (first, last, or any)\n- Close a tab\n- Close the entire browser\n\n### Working with Driver Objects\n\nA `driver` object is available on any `Tab` object,\nallowing you to access the browser/driver object\nand use Selenium methods when needed without making explicit switches to a specific tab.\n\n### Features\n\n**Selenium Tabs** offers a range of features to enhance your web automation tasks:\n- Effortless tab management\n- Seamless tab switching\n- Real-time tab status tracking\n- Convenient tab closure\n- Built-in functions for scrolling, clicking, waiting for conditions, finding and more\n- Access to the underlying Selenium `driver` object for advanced usage\n- Access `driver` methods directly on tabs\n- Automatic User agent selection based on set browser\n- Basic steps to avoid getting flagged as an automation script by websites\n- Use the all-powerful `pyquery` object access on each tab\n- Execute jquery functions using `.jq` or `.jquery` attributes\n\n### Usage\n\nTo get started with **Selenium Tabs**, create a `Browser` object and open tabs using the `open` method:\n\n#### Browser\n\nCreate a `Browser` object, specifying the browser name (e.g. \"Chrome\" or \"FireFox\").\nThe project automatically downloads drivers.\n\n```python\nfrom seleniumtabs import Browser, Tab\n\n\nwith Browser(name=\"Chrome\", implicit_wait=10) as browser:\n    google = browser.open(\"https://google.com\")\n    yahoo = browser.open(\"https://yahoo.com\")\n    bing = browser.open(\"https://bing.com\")\n    duck_duck = browser.open(\"https://duckduckgo.com/\")\n\n    # Scroll on the page (example)\n    yahoo.scroll(times=2)\n    yahoo.scroll_to_bottom()\n\n    # Working with tabs\n    for tab in browser.tabs:\n        print(tab)\n\n    print(browser.tabs)\n    print(browser.current_tab)\n\n    # Selecting elements with JQuery (using browserjquery package)\n    print(yahoo.jq(\"a\"))\n\n    # Selecting using CSS Selectors (no JQuery needed)\n    for item in yahoo.css(\".stream-items\"):\n        for a in item.css(\"a\"):\n            print(a, a.text)\n\n    # Some `Tab` attributes/properties\n    print(google.title)\n    print(google.url)\n    print(google.page_source)\n\n    # Closing a tab\n    bing.close() # Or browser.close_tab(bing)\n\n    # Switching to a tab\n    yahoo.switch()\n    google.switch()\n\n    # Accessing the driver object\n    print(google.driver.title, google.title) # Should output same value\n\n    # Directly access driver methods and attributes\n    print(google.current_window_handle, google.tab_handle)\n    google.refresh()\n\n    # PyQuery\n    print(google.pyquery.text())\n    print(google.pq.size())\n```\n\n### TODO\n\n- Complete documentation\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Selenium with tab management in Python",
    "version": "0.5.7",
    "project_urls": {
        "Homepage": "https://github.com/TheConfused/selenium-tabs",
        "Repository": "https://github.com/TheConfused/selenium-tabs"
    },
    "split_keywords": [
        "selenium tabs",
        " selenium python",
        " selenium python automation",
        " python automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0595dfb076240b54cfc7d6570f1a9d9d3e856d4378377efb8803f315833faeaf",
                "md5": "90b208c3efa40175a5048a44a6f938a0",
                "sha256": "0154c13b2a4c63e569f5471601b29f5d9b99e47b1d22d7238fa39a05e705c982"
            },
            "downloads": -1,
            "filename": "seleniumtabs-0.5.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "90b208c3efa40175a5048a44a6f938a0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 19233,
            "upload_time": "2024-09-10T15:58:21",
            "upload_time_iso_8601": "2024-09-10T15:58:21.269525Z",
            "url": "https://files.pythonhosted.org/packages/05/95/dfb076240b54cfc7d6570f1a9d9d3e856d4378377efb8803f315833faeaf/seleniumtabs-0.5.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0bb1f3ef48f588a7450b075e574608fda9eb680820e6c8084ee7a4ff58410d7",
                "md5": "21e3c96ff6f93b28691d8e5cb684867c",
                "sha256": "acca1fb6bac611139edcbbbb5a4a518427eeb6daac7124d9233685e9c350988e"
            },
            "downloads": -1,
            "filename": "seleniumtabs-0.5.7.tar.gz",
            "has_sig": false,
            "md5_digest": "21e3c96ff6f93b28691d8e5cb684867c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 15677,
            "upload_time": "2024-09-10T15:58:22",
            "upload_time_iso_8601": "2024-09-10T15:58:22.679599Z",
            "url": "https://files.pythonhosted.org/packages/c0/bb/1f3ef48f588a7450b075e574608fda9eb680820e6c8084ee7a4ff58410d7/seleniumtabs-0.5.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-10 15:58:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TheConfused",
    "github_project": "selenium-tabs",
    "github_not_found": true,
    "lcname": "seleniumtabs"
}
        
Elapsed time: 0.35407s