[
  {
    "path": ".github/workflows/workflow.yml",
    "content": "\n\nname: Python package\n\non:\n  push:\n    branches: [ \"master\" ]\n  pull_request:\n    branches: [ \"master\" ]\n\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        python-version: [\"3.8\", \"3.9\", \"3.10\",\"3.11\"]\n\n    steps:\n    - uses: actions/checkout@v3\n    - name: Setup Chrome\n      uses: browser-actions/setup-chrome@v1.2.0\n      with:\n        chrome-version: stable\n    - name: set chrome in path\n      run: | \n        echo \"/opt/hostedtoolcache/chromium/stable/x64\" >> $GITHUB_PATH\n    - name: Set up Python ${{ matrix.python-version }}\n      uses: actions/setup-python@v3\n      with:\n        python-version: ${{ matrix.python-version }}\n    - name: Install package\n      run: |\n        python -m pip install --upgrade pip\n        if [ -f requirements.txt ]; then pip install -r requirements.txt; else pip install -U . ; fi\n    - name: run example\n      run: |\n        python example/test_workflow.py\n    - name: Upload a Build Artifact\n      uses: actions/upload-artifact@v3.1.2\n      with:\n        # Artifact name\n        name:  screenshots\n        # A file, directory or wildcard pattern that describes what to upload\n        path: /home/runner/work/_temp/*p*\n    \n    \n    \n\n\n"
  },
  {
    "path": ".gitignore",
    "content": "# Byte-compiled / optimized / DLL files\r\n__pycache__/\r\n*.py[cod]\r\n*$py.class\r\n\r\n# C extensions\r\n*.so\r\n\r\n# Distribution / packaging\r\n.Python\r\nbuild/\r\ndevelop-eggs/\r\ndist/\r\ndownloads/\r\neggs/\r\n.eggs/\r\nlib/\r\nlib64/\r\nparts/\r\nsdist/\r\nvar/\r\nwheels/\r\npip-wheel-metadata/\r\nshare/python-wheels/\r\n*.egg-info/\r\n.installed.cfg\r\n*.egg\r\nMANIFEST\r\n\r\n# PyInstaller\r\n#  Usually these files are written by a python script from a template\r\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\r\n*.manifest\r\n*.spec\r\n\r\n# Installer logs\r\npip-log.txt\r\npip-delete-this-directory.txt\r\n\r\n# Unit test / coverage reports\r\nhtmlcov/\r\n.tox/\r\n.nox/\r\n.coverage\r\n.coverage.*\r\n.cache\r\nnosetests.xml\r\ncoverage.xml\r\n*.cover\r\n*.py,cover\r\n.hypothesis/\r\n.pytest_cache/\r\n\r\n# Translations\r\n*.mo\r\n*.pot\r\n\r\n# Django stuff:\r\n*.log\r\nlocal_settings.py\r\ndb.sqlite3\r\ndb.sqlite3-journal\r\n\r\n# Flask stuff:\r\ninstance/\r\n.webassets-cache\r\n\r\n# Scrapy stuff:\r\n.scrapy\r\n\r\n# Sphinx documentation\r\ndocs/_build/\r\n\r\n# PyBuilder\r\ntarget/\r\n\r\n# Jupyter Notebook\r\n.ipynb_checkpoints\r\n\r\n# IPython\r\nprofile_default/\r\nipython_config.py\r\n\r\n# pyenv\r\n.python-version\r\n\r\n# pipenv\r\n#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.\r\n#   However, in case of collaboration, if having platform-specific dependencies or dependencies\r\n#   having no cross-platform support, pipenv may install dependencies that don't work, or not\r\n#   install all needed dependencies.\r\n#Pipfile.lock\r\n\r\n# PEP 582; used by e.g. github.com/David-OConnor/pyflow\r\n__pypackages__/\r\n\r\n# Celery stuff\r\ncelerybeat-schedule\r\ncelerybeat.pid\r\n\r\n# SageMath parsed files\r\n*.sage.py\r\n\r\n# Environments\r\n.env\r\n.venv\r\nenv/\r\nvenv/\r\nENV/\r\nenv.bak/\r\nvenv.bak/\r\n\r\n# Spyder project settings\r\n.spyderproject\r\n.spyproject\r\n\r\n# Rope project settings\r\n.ropeproject\r\n\r\n# mkdocs documentation\r\n/site\r\n\r\n# mypy\r\n.mypy_cache/\r\n.dmypy.json\r\ndmypy.json\r\n\r\n# Pyre type checker\r\n.pyre/\r\n\r\n.idea\r\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\r\n                       Version 3, 29 June 2007\r\n\r\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\r\n Everyone is permitted to copy and distribute verbatim copies\r\n of this license document, but changing it is not allowed.\r\n\r\n                            Preamble\r\n\r\n  The GNU General Public License is a free, copyleft license for\r\nsoftware and other kinds of works.\r\n\r\n  The licenses for most software and other practical works are designed\r\nto take away your freedom to share and change the works.  By contrast,\r\nthe GNU General Public License is intended to guarantee your freedom to\r\nshare and change all versions of a program--to make sure it remains free\r\nsoftware for all its users.  We, the Free Software Foundation, use the\r\nGNU General Public License for most of our software; it applies also to\r\nany other work released this way by its authors.  You can apply it to\r\nyour programs, too.\r\n\r\n  When we speak of free software, we are referring to freedom, not\r\nprice.  Our General Public Licenses are designed to make sure that you\r\nhave the freedom to distribute copies of free software (and charge for\r\nthem if you wish), that you receive source code or can get it if you\r\nwant it, that you can change the software or use pieces of it in new\r\nfree programs, and that you know you can do these things.\r\n\r\n  To protect your rights, we need to prevent others from denying you\r\nthese rights or asking you to surrender the rights.  Therefore, you have\r\ncertain responsibilities if you distribute copies of the software, or if\r\nyou modify it: responsibilities to respect the freedom of others.\r\n\r\n  For example, if you distribute copies of such a program, whether\r\ngratis or for a fee, you must pass on to the recipients the same\r\nfreedoms that you received.  You must make sure that they, too, receive\r\nor can get the source code.  And you must show them these terms so they\r\nknow their rights.\r\n\r\n  Developers that use the GNU GPL protect your rights with two steps:\r\n(1) assert copyright on the software, and (2) offer you this License\r\ngiving you legal permission to copy, distribute and/or modify it.\r\n\r\n  For the developers' and authors' protection, the GPL clearly explains\r\nthat there is no warranty for this free software.  For both users' and\r\nauthors' sake, the GPL requires that modified versions be marked as\r\nchanged, so that their problems will not be attributed erroneously to\r\nauthors of previous versions.\r\n\r\n  Some devices are designed to deny users access to install or run\r\nmodified versions of the software inside them, although the manufacturer\r\ncan do so.  This is fundamentally incompatible with the aim of\r\nprotecting users' freedom to change the software.  The systematic\r\npattern of such abuse occurs in the area of products for individuals to\r\nuse, which is precisely where it is most unacceptable.  Therefore, we\r\nhave designed this version of the GPL to prohibit the practice for those\r\nproducts.  If such problems arise substantially in other domains, we\r\nstand ready to extend this provision to those domains in future versions\r\nof the GPL, as needed to protect the freedom of users.\r\n\r\n  Finally, every program is threatened constantly by software patents.\r\nStates should not allow patents to restrict development and use of\r\nsoftware on general-purpose computers, but in those that do, we wish to\r\navoid the special danger that patents applied to a free program could\r\nmake it effectively proprietary.  To prevent this, the GPL assures that\r\npatents cannot be used to render the program non-free.\r\n\r\n  The precise terms and conditions for copying, distribution and\r\nmodification follow.\r\n\r\n                       TERMS AND CONDITIONS\r\n\r\n  0. Definitions.\r\n\r\n  \"This License\" refers to version 3 of the GNU General Public License.\r\n\r\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\r\nworks, such as semiconductor masks.\r\n\r\n  \"The Program\" refers to any copyrightable work licensed under this\r\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\r\n\"recipients\" may be individuals or organizations.\r\n\r\n  To \"modify\" a work means to copy from or adapt all or part of the work\r\nin a fashion requiring copyright permission, other than the making of an\r\nexact copy.  The resulting work is called a \"modified version\" of the\r\nearlier work or a work \"based on\" the earlier work.\r\n\r\n  A \"covered work\" means either the unmodified Program or a work based\r\non the Program.\r\n\r\n  To \"propagate\" a work means to do anything with it that, without\r\npermission, would make you directly or secondarily liable for\r\ninfringement under applicable copyright law, except executing it on a\r\ncomputer or modifying a private copy.  Propagation includes copying,\r\ndistribution (with or without modification), making available to the\r\npublic, and in some countries other activities as well.\r\n\r\n  To \"convey\" a work means any kind of propagation that enables other\r\nparties to make or receive copies.  Mere interaction with a user through\r\na computer network, with no transfer of a copy, is not conveying.\r\n\r\n  An interactive user interface displays \"Appropriate Legal Notices\"\r\nto the extent that it includes a convenient and prominently visible\r\nfeature that (1) displays an appropriate copyright notice, and (2)\r\ntells the user that there is no warranty for the work (except to the\r\nextent that warranties are provided), that licensees may convey the\r\nwork under this License, and how to view a copy of this License.  If\r\nthe interface presents a list of user commands or options, such as a\r\nmenu, a prominent item in the list meets this criterion.\r\n\r\n  1. Source Code.\r\n\r\n  The \"source code\" for a work means the preferred form of the work\r\nfor making modifications to it.  \"Object code\" means any non-source\r\nform of a work.\r\n\r\n  A \"Standard Interface\" means an interface that either is an official\r\nstandard defined by a recognized standards body, or, in the case of\r\ninterfaces specified for a particular programming language, one that\r\nis widely used among developers working in that language.\r\n\r\n  The \"System Libraries\" of an executable work include anything, other\r\nthan the work as a whole, that (a) is included in the normal form of\r\npackaging a Major Component, but which is not part of that Major\r\nComponent, and (b) serves only to enable use of the work with that\r\nMajor Component, or to implement a Standard Interface for which an\r\nimplementation is available to the public in source code form.  A\r\n\"Major Component\", in this context, means a major essential component\r\n(kernel, window system, and so on) of the specific operating system\r\n(if any) on which the executable work runs, or a compiler used to\r\nproduce the work, or an object code interpreter used to run it.\r\n\r\n  The \"Corresponding Source\" for a work in object code form means all\r\nthe source code needed to generate, install, and (for an executable\r\nwork) run the object code and to modify the work, including scripts to\r\ncontrol those activities.  However, it does not include the work's\r\nSystem Libraries, or general-purpose tools or generally available free\r\nprograms which are used unmodified in performing those activities but\r\nwhich are not part of the work.  For example, Corresponding Source\r\nincludes interface definition files associated with source files for\r\nthe work, and the source code for shared libraries and dynamically\r\nlinked subprograms that the work is specifically designed to require,\r\nsuch as by intimate data communication or control flow between those\r\nsubprograms and other parts of the work.\r\n\r\n  The Corresponding Source need not include anything that users\r\ncan regenerate automatically from other parts of the Corresponding\r\nSource.\r\n\r\n  The Corresponding Source for a work in source code form is that\r\nsame work.\r\n\r\n  2. Basic Permissions.\r\n\r\n  All rights granted under this License are granted for the term of\r\ncopyright on the Program, and are irrevocable provided the stated\r\nconditions are met.  This License explicitly affirms your unlimited\r\npermission to run the unmodified Program.  The output from running a\r\ncovered work is covered by this License only if the output, given its\r\ncontent, constitutes a covered work.  This License acknowledges your\r\nrights of fair use or other equivalent, as provided by copyright law.\r\n\r\n  You may make, run and propagate covered works that you do not\r\nconvey, without conditions so long as your license otherwise remains\r\nin force.  You may convey covered works to others for the sole purpose\r\nof having them make modifications exclusively for you, or provide you\r\nwith facilities for running those works, provided that you comply with\r\nthe terms of this License in conveying all material for which you do\r\nnot control copyright.  Those thus making or running the covered works\r\nfor you must do so exclusively on your behalf, under your direction\r\nand control, on terms that prohibit them from making any copies of\r\nyour copyrighted material outside their relationship with you.\r\n\r\n  Conveying under any other circumstances is permitted solely under\r\nthe conditions stated below.  Sublicensing is not allowed; section 10\r\nmakes it unnecessary.\r\n\r\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\r\n\r\n  No covered work shall be deemed part of an effective technological\r\nmeasure under any applicable law fulfilling obligations under article\r\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\r\nsimilar laws prohibiting or restricting circumvention of such\r\nmeasures.\r\n\r\n  When you convey a covered work, you waive any legal power to forbid\r\ncircumvention of technological measures to the extent such circumvention\r\nis effected by exercising rights under this License with respect to\r\nthe covered work, and you disclaim any intention to limit operation or\r\nmodification of the work as a means of enforcing, against the work's\r\nusers, your or third parties' legal rights to forbid circumvention of\r\ntechnological measures.\r\n\r\n  4. Conveying Verbatim Copies.\r\n\r\n  You may convey verbatim copies of the Program's source code as you\r\nreceive it, in any medium, provided that you conspicuously and\r\nappropriately publish on each copy an appropriate copyright notice;\r\nkeep intact all notices stating that this License and any\r\nnon-permissive terms added in accord with section 7 apply to the code;\r\nkeep intact all notices of the absence of any warranty; and give all\r\nrecipients a copy of this License along with the Program.\r\n\r\n  You may charge any price or no price for each copy that you convey,\r\nand you may offer support or warranty protection for a fee.\r\n\r\n  5. Conveying Modified Source Versions.\r\n\r\n  You may convey a work based on the Program, or the modifications to\r\nproduce it from the Program, in the form of source code under the\r\nterms of section 4, provided that you also meet all of these conditions:\r\n\r\n    a) The work must carry prominent notices stating that you modified\r\n    it, and giving a relevant date.\r\n\r\n    b) The work must carry prominent notices stating that it is\r\n    released under this License and any conditions added under section\r\n    7.  This requirement modifies the requirement in section 4 to\r\n    \"keep intact all notices\".\r\n\r\n    c) You must license the entire work, as a whole, under this\r\n    License to anyone who comes into possession of a copy.  This\r\n    License will therefore apply, along with any applicable section 7\r\n    additional terms, to the whole of the work, and all its parts,\r\n    regardless of how they are packaged.  This License gives no\r\n    permission to license the work in any other way, but it does not\r\n    invalidate such permission if you have separately received it.\r\n\r\n    d) If the work has interactive user interfaces, each must display\r\n    Appropriate Legal Notices; however, if the Program has interactive\r\n    interfaces that do not display Appropriate Legal Notices, your\r\n    work need not make them do so.\r\n\r\n  A compilation of a covered work with other separate and independent\r\nworks, which are not by their nature extensions of the covered work,\r\nand which are not combined with it such as to form a larger program,\r\nin or on a volume of a storage or distribution medium, is called an\r\n\"aggregate\" if the compilation and its resulting copyright are not\r\nused to limit the access or legal rights of the compilation's users\r\nbeyond what the individual works permit.  Inclusion of a covered work\r\nin an aggregate does not cause this License to apply to the other\r\nparts of the aggregate.\r\n\r\n  6. Conveying Non-Source Forms.\r\n\r\n  You may convey a covered work in object code form under the terms\r\nof sections 4 and 5, provided that you also convey the\r\nmachine-readable Corresponding Source under the terms of this License,\r\nin one of these ways:\r\n\r\n    a) Convey the object code in, or embodied in, a physical product\r\n    (including a physical distribution medium), accompanied by the\r\n    Corresponding Source fixed on a durable physical medium\r\n    customarily used for software interchange.\r\n\r\n    b) Convey the object code in, or embodied in, a physical product\r\n    (including a physical distribution medium), accompanied by a\r\n    written offer, valid for at least three years and valid for as\r\n    long as you offer spare parts or customer support for that product\r\n    model, to give anyone who possesses the object code either (1) a\r\n    copy of the Corresponding Source for all the software in the\r\n    product that is covered by this License, on a durable physical\r\n    medium customarily used for software interchange, for a price no\r\n    more than your reasonable cost of physically performing this\r\n    conveying of source, or (2) access to copy the\r\n    Corresponding Source from a network server at no charge.\r\n\r\n    c) Convey individual copies of the object code with a copy of the\r\n    written offer to provide the Corresponding Source.  This\r\n    alternative is allowed only occasionally and noncommercially, and\r\n    only if you received the object code with such an offer, in accord\r\n    with subsection 6b.\r\n\r\n    d) Convey the object code by offering access from a designated\r\n    place (gratis or for a charge), and offer equivalent access to the\r\n    Corresponding Source in the same way through the same place at no\r\n    further charge.  You need not require recipients to copy the\r\n    Corresponding Source along with the object code.  If the place to\r\n    copy the object code is a network server, the Corresponding Source\r\n    may be on a different server (operated by you or a third party)\r\n    that supports equivalent copying facilities, provided you maintain\r\n    clear directions next to the object code saying where to find the\r\n    Corresponding Source.  Regardless of what server hosts the\r\n    Corresponding Source, you remain obligated to ensure that it is\r\n    available for as long as needed to satisfy these requirements.\r\n\r\n    e) Convey the object code using peer-to-peer transmission, provided\r\n    you inform other peers where the object code and Corresponding\r\n    Source of the work are being offered to the general public at no\r\n    charge under subsection 6d.\r\n\r\n  A separable portion of the object code, whose source code is excluded\r\nfrom the Corresponding Source as a System Library, need not be\r\nincluded in conveying the object code work.\r\n\r\n  A \"User Product\" is either (1) a \"consumer product\", which means any\r\ntangible personal property which is normally used for personal, family,\r\nor household purposes, or (2) anything designed or sold for incorporation\r\ninto a dwelling.  In determining whether a product is a consumer product,\r\ndoubtful cases shall be resolved in favor of coverage.  For a particular\r\nproduct received by a particular user, \"normally used\" refers to a\r\ntypical or common use of that class of product, regardless of the status\r\nof the particular user or of the way in which the particular user\r\nactually uses, or expects or is expected to use, the product.  A product\r\nis a consumer product regardless of whether the product has substantial\r\ncommercial, industrial or non-consumer uses, unless such uses represent\r\nthe only significant mode of use of the product.\r\n\r\n  \"Installation Information\" for a User Product means any methods,\r\nprocedures, authorization keys, or other information required to install\r\nand execute modified versions of a covered work in that User Product from\r\na modified version of its Corresponding Source.  The information must\r\nsuffice to ensure that the continued functioning of the modified object\r\ncode is in no case prevented or interfered with solely because\r\nmodification has been made.\r\n\r\n  If you convey an object code work under this section in, or with, or\r\nspecifically for use in, a User Product, and the conveying occurs as\r\npart of a transaction in which the right of possession and use of the\r\nUser Product is transferred to the recipient in perpetuity or for a\r\nfixed term (regardless of how the transaction is characterized), the\r\nCorresponding Source conveyed under this section must be accompanied\r\nby the Installation Information.  But this requirement does not apply\r\nif neither you nor any third party retains the ability to install\r\nmodified object code on the User Product (for example, the work has\r\nbeen installed in ROM).\r\n\r\n  The requirement to provide Installation Information does not include a\r\nrequirement to continue to provide support service, warranty, or updates\r\nfor a work that has been modified or installed by the recipient, or for\r\nthe User Product in which it has been modified or installed.  Access to a\r\nnetwork may be denied when the modification itself materially and\r\nadversely affects the operation of the network or violates the rules and\r\nprotocols for communication across the network.\r\n\r\n  Corresponding Source conveyed, and Installation Information provided,\r\nin accord with this section must be in a format that is publicly\r\ndocumented (and with an implementation available to the public in\r\nsource code form), and must require no special password or key for\r\nunpacking, reading or copying.\r\n\r\n  7. Additional Terms.\r\n\r\n  \"Additional permissions\" are terms that supplement the terms of this\r\nLicense by making exceptions from one or more of its conditions.\r\nAdditional permissions that are applicable to the entire Program shall\r\nbe treated as though they were included in this License, to the extent\r\nthat they are valid under applicable law.  If additional permissions\r\napply only to part of the Program, that part may be used separately\r\nunder those permissions, but the entire Program remains governed by\r\nthis License without regard to the additional permissions.\r\n\r\n  When you convey a copy of a covered work, you may at your option\r\nremove any additional permissions from that copy, or from any part of\r\nit.  (Additional permissions may be written to require their own\r\nremoval in certain cases when you modify the work.)  You may place\r\nadditional permissions on material, added by you to a covered work,\r\nfor which you have or can give appropriate copyright permission.\r\n\r\n  Notwithstanding any other provision of this License, for material you\r\nadd to a covered work, you may (if authorized by the copyright holders of\r\nthat material) supplement the terms of this License with terms:\r\n\r\n    a) Disclaiming warranty or limiting liability differently from the\r\n    terms of sections 15 and 16 of this License; or\r\n\r\n    b) Requiring preservation of specified reasonable legal notices or\r\n    author attributions in that material or in the Appropriate Legal\r\n    Notices displayed by works containing it; or\r\n\r\n    c) Prohibiting misrepresentation of the origin of that material, or\r\n    requiring that modified versions of such material be marked in\r\n    reasonable ways as different from the original version; or\r\n\r\n    d) Limiting the use for publicity purposes of names of licensors or\r\n    authors of the material; or\r\n\r\n    e) Declining to grant rights under trademark law for use of some\r\n    trade names, trademarks, or service marks; or\r\n\r\n    f) Requiring indemnification of licensors and authors of that\r\n    material by anyone who conveys the material (or modified versions of\r\n    it) with contractual assumptions of liability to the recipient, for\r\n    any liability that these contractual assumptions directly impose on\r\n    those licensors and authors.\r\n\r\n  All other non-permissive additional terms are considered \"further\r\nrestrictions\" within the meaning of section 10.  If the Program as you\r\nreceived it, or any part of it, contains a notice stating that it is\r\ngoverned by this License along with a term that is a further\r\nrestriction, you may remove that term.  If a license document contains\r\na further restriction but permits relicensing or conveying under this\r\nLicense, you may add to a covered work material governed by the terms\r\nof that license document, provided that the further restriction does\r\nnot survive such relicensing or conveying.\r\n\r\n  If you add terms to a covered work in accord with this section, you\r\nmust place, in the relevant source files, a statement of the\r\nadditional terms that apply to those files, or a notice indicating\r\nwhere to find the applicable terms.\r\n\r\n  Additional terms, permissive or non-permissive, may be stated in the\r\nform of a separately written license, or stated as exceptions;\r\nthe above requirements apply either way.\r\n\r\n  8. Termination.\r\n\r\n  You may not propagate or modify a covered work except as expressly\r\nprovided under this License.  Any attempt otherwise to propagate or\r\nmodify it is void, and will automatically terminate your rights under\r\nthis License (including any patent licenses granted under the third\r\nparagraph of section 11).\r\n\r\n  However, if you cease all violation of this License, then your\r\nlicense from a particular copyright holder is reinstated (a)\r\nprovisionally, unless and until the copyright holder explicitly and\r\nfinally terminates your license, and (b) permanently, if the copyright\r\nholder fails to notify you of the violation by some reasonable means\r\nprior to 60 days after the cessation.\r\n\r\n  Moreover, your license from a particular copyright holder is\r\nreinstated permanently if the copyright holder notifies you of the\r\nviolation by some reasonable means, this is the first time you have\r\nreceived notice of violation of this License (for any work) from that\r\ncopyright holder, and you cure the violation prior to 30 days after\r\nyour receipt of the notice.\r\n\r\n  Termination of your rights under this section does not terminate the\r\nlicenses of parties who have received copies or rights from you under\r\nthis License.  If your rights have been terminated and not permanently\r\nreinstated, you do not qualify to receive new licenses for the same\r\nmaterial under section 10.\r\n\r\n  9. Acceptance Not Required for Having Copies.\r\n\r\n  You are not required to accept this License in order to receive or\r\nrun a copy of the Program.  Ancillary propagation of a covered work\r\noccurring solely as a consequence of using peer-to-peer transmission\r\nto receive a copy likewise does not require acceptance.  However,\r\nnothing other than this License grants you permission to propagate or\r\nmodify any covered work.  These actions infringe copyright if you do\r\nnot accept this License.  Therefore, by modifying or propagating a\r\ncovered work, you indicate your acceptance of this License to do so.\r\n\r\n  10. Automatic Licensing of Downstream Recipients.\r\n\r\n  Each time you convey a covered work, the recipient automatically\r\nreceives a license from the original licensors, to run, modify and\r\npropagate that work, subject to this License.  You are not responsible\r\nfor enforcing compliance by third parties with this License.\r\n\r\n  An \"entity transaction\" is a transaction transferring control of an\r\norganization, or substantially all assets of one, or subdividing an\r\norganization, or merging organizations.  If propagation of a covered\r\nwork results from an entity transaction, each party to that\r\ntransaction who receives a copy of the work also receives whatever\r\nlicenses to the work the party's predecessor in interest had or could\r\ngive under the previous paragraph, plus a right to possession of the\r\nCorresponding Source of the work from the predecessor in interest, if\r\nthe predecessor has it or can get it with reasonable efforts.\r\n\r\n  You may not impose any further restrictions on the exercise of the\r\nrights granted or affirmed under this License.  For example, you may\r\nnot impose a license fee, royalty, or other charge for exercise of\r\nrights granted under this License, and you may not initiate litigation\r\n(including a cross-claim or counterclaim in a lawsuit) alleging that\r\nany patent claim is infringed by making, using, selling, offering for\r\nsale, or importing the Program or any portion of it.\r\n\r\n  11. Patents.\r\n\r\n  A \"contributor\" is a copyright holder who authorizes use under this\r\nLicense of the Program or a work on which the Program is based.  The\r\nwork thus licensed is called the contributor's \"contributor version\".\r\n\r\n  A contributor's \"essential patent claims\" are all patent claims\r\nowned or controlled by the contributor, whether already acquired or\r\nhereafter acquired, that would be infringed by some manner, permitted\r\nby this License, of making, using, or selling its contributor version,\r\nbut do not include claims that would be infringed only as a\r\nconsequence of further modification of the contributor version.  For\r\npurposes of this definition, \"control\" includes the right to grant\r\npatent sublicenses in a manner consistent with the requirements of\r\nthis License.\r\n\r\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\r\npatent license under the contributor's essential patent claims, to\r\nmake, use, sell, offer for sale, import and otherwise run, modify and\r\npropagate the contents of its contributor version.\r\n\r\n  In the following three paragraphs, a \"patent license\" is any express\r\nagreement or commitment, however denominated, not to enforce a patent\r\n(such as an express permission to practice a patent or covenant not to\r\nsue for patent infringement).  To \"grant\" such a patent license to a\r\nparty means to make such an agreement or commitment not to enforce a\r\npatent against the party.\r\n\r\n  If you convey a covered work, knowingly relying on a patent license,\r\nand the Corresponding Source of the work is not available for anyone\r\nto copy, free of charge and under the terms of this License, through a\r\npublicly available network server or other readily accessible means,\r\nthen you must either (1) cause the Corresponding Source to be so\r\navailable, or (2) arrange to deprive yourself of the benefit of the\r\npatent license for this particular work, or (3) arrange, in a manner\r\nconsistent with the requirements of this License, to extend the patent\r\nlicense to downstream recipients.  \"Knowingly relying\" means you have\r\nactual knowledge that, but for the patent license, your conveying the\r\ncovered work in a country, or your recipient's use of the covered work\r\nin a country, would infringe one or more identifiable patents in that\r\ncountry that you have reason to believe are valid.\r\n\r\n  If, pursuant to or in connection with a single transaction or\r\narrangement, you convey, or propagate by procuring conveyance of, a\r\ncovered work, and grant a patent license to some of the parties\r\nreceiving the covered work authorizing them to use, propagate, modify\r\nor convey a specific copy of the covered work, then the patent license\r\nyou grant is automatically extended to all recipients of the covered\r\nwork and works based on it.\r\n\r\n  A patent license is \"discriminatory\" if it does not include within\r\nthe scope of its coverage, prohibits the exercise of, or is\r\nconditioned on the non-exercise of one or more of the rights that are\r\nspecifically granted under this License.  You may not convey a covered\r\nwork if you are a party to an arrangement with a third party that is\r\nin the business of distributing software, under which you make payment\r\nto the third party based on the extent of your activity of conveying\r\nthe work, and under which the third party grants, to any of the\r\nparties who would receive the covered work from you, a discriminatory\r\npatent license (a) in connection with copies of the covered work\r\nconveyed by you (or copies made from those copies), or (b) primarily\r\nfor and in connection with specific products or compilations that\r\ncontain the covered work, unless you entered into that arrangement,\r\nor that patent license was granted, prior to 28 March 2007.\r\n\r\n  Nothing in this License shall be construed as excluding or limiting\r\nany implied license or other defenses to infringement that may\r\notherwise be available to you under applicable patent law.\r\n\r\n  12. No Surrender of Others' Freedom.\r\n\r\n  If conditions are imposed on you (whether by court order, agreement or\r\notherwise) that contradict the conditions of this License, they do not\r\nexcuse you from the conditions of this License.  If you cannot convey a\r\ncovered work so as to satisfy simultaneously your obligations under this\r\nLicense and any other pertinent obligations, then as a consequence you may\r\nnot convey it at all.  For example, if you agree to terms that obligate you\r\nto collect a royalty for further conveying from those to whom you convey\r\nthe Program, the only way you could satisfy both those terms and this\r\nLicense would be to refrain entirely from conveying the Program.\r\n\r\n  13. Use with the GNU Affero General Public License.\r\n\r\n  Notwithstanding any other provision of this License, you have\r\npermission to link or combine any covered work with a work licensed\r\nunder version 3 of the GNU Affero General Public License into a single\r\ncombined work, and to convey the resulting work.  The terms of this\r\nLicense will continue to apply to the part which is the covered work,\r\nbut the special requirements of the GNU Affero General Public License,\r\nsection 13, concerning interaction through a network will apply to the\r\ncombination as such.\r\n\r\n  14. Revised Versions of this License.\r\n\r\n  The Free Software Foundation may publish revised and/or new versions of\r\nthe GNU General Public License from time to time.  Such new versions will\r\nbe similar in spirit to the present version, but may differ in detail to\r\naddress new problems or concerns.\r\n\r\n  Each version is given a distinguishing version number.  If the\r\nProgram specifies that a certain numbered version of the GNU General\r\nPublic License \"or any later version\" applies to it, you have the\r\noption of following the terms and conditions either of that numbered\r\nversion or of any later version published by the Free Software\r\nFoundation.  If the Program does not specify a version number of the\r\nGNU General Public License, you may choose any version ever published\r\nby the Free Software Foundation.\r\n\r\n  If the Program specifies that a proxy can decide which future\r\nversions of the GNU General Public License can be used, that proxy's\r\npublic statement of acceptance of a version permanently authorizes you\r\nto choose that version for the Program.\r\n\r\n  Later license versions may give you additional or different\r\npermissions.  However, no additional obligations are imposed on any\r\nauthor or copyright holder as a result of your choosing to follow a\r\nlater version.\r\n\r\n  15. Disclaimer of Warranty.\r\n\r\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\r\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\r\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\r\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\r\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\r\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\r\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\r\n\r\n  16. Limitation of Liability.\r\n\r\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\r\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\r\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\r\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\r\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\r\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\r\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\r\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\r\nSUCH DAMAGES.\r\n\r\n  17. Interpretation of Sections 15 and 16.\r\n\r\n  If the disclaimer of warranty and limitation of liability provided\r\nabove cannot be given local legal effect according to their terms,\r\nreviewing courts shall apply local law that most closely approximates\r\nan absolute waiver of all civil liability in connection with the\r\nProgram, unless a warranty or assumption of liability accompanies a\r\ncopy of the Program in return for a fee.\r\n\r\n                     END OF TERMS AND CONDITIONS\r\n\r\n            How to Apply These Terms to Your New Programs\r\n\r\n  If you develop a new program, and you want it to be of the greatest\r\npossible use to the public, the best way to achieve this is to make it\r\nfree software which everyone can redistribute and change under these terms.\r\n\r\n  To do so, attach the following notices to the program.  It is safest\r\nto attach them to the start of each source file to most effectively\r\nstate the exclusion of warranty; and each file should have at least\r\nthe \"copyright\" line and a pointer to where the full notice is found.\r\n\r\n    <one line to give the program's name and a brief idea of what it does.>\r\n    Copyright (C) <year>  <name of author>\r\n\r\n    This program is free software: you can redistribute it and/or modify\r\n    it under the terms of the GNU General Public License as published by\r\n    the Free Software Foundation, either version 3 of the License, or\r\n    (at your option) any later version.\r\n\r\n    This program is distributed in the hope that it will be useful,\r\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\n    GNU General Public License for more details.\r\n\r\n    You should have received a copy of the GNU General Public License\r\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\r\n\r\nAlso add information on how to contact you by electronic and paper mail.\r\n\r\n  If the program does terminal interaction, make it output a short\r\nnotice like this when it starts in an interactive mode:\r\n\r\n    <program>  Copyright (C) <year>  <name of author>\r\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\r\n    This is free software, and you are welcome to redistribute it\r\n    under certain conditions; type `show c' for details.\r\n\r\nThe hypothetical commands `show w' and `show c' should show the appropriate\r\nparts of the General Public License.  Of course, your program's commands\r\nmight be different; for a GUI interface, you would use an \"about box\".\r\n\r\n  You should also get your employer (if you work as a programmer) or school,\r\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\r\nFor more information on this, and how to apply and follow the GNU GPL, see\r\n<https://www.gnu.org/licenses/>.\r\n\r\n  The GNU General Public License does not permit incorporating your program\r\ninto proprietary programs.  If your program is a subroutine library, you\r\nmay consider it more useful to permit linking proprietary applications with\r\nthe library.  If this is what you want to do, use the GNU Lesser General\r\nPublic License instead of this License.  But first, please read\r\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\r\n"
  },
  {
    "path": "README.md",
    "content": "# undetected_chromedriver #\r\n\r\nhttps://github.com/ultrafunkamsterdam/undetected-chromedriver\r\n\r\n\r\nOptimized Selenium Chromedriver patch which does not trigger anti-bot services like Distill Network / Imperva / DataDome / Botprotect.io\r\nAutomatically downloads the driver binary and patches it.\r\n\r\n* Tested until current chrome beta versions\r\n* Works also on Brave Browser and many other Chromium based browsers, but you need to know what you're doing and needs some tweaking.\r\n* Python 3.6++**\r\n\r\n\r\n## Installation ##\r\n\r\n```\r\npip install undetected-chromedriver\r\n```\r\nor , if you're feeling adventurous, install directly via github\r\n\r\n```\r\npip install git+https://www.github.com/ultrafunkamsterdam/undetected-chromedriver@master     # replace @master with @branchname for other branches\r\n```\r\n\r\n\r\n- - -\r\n## Message for all ##\r\nI will be putting limits on the issue tracker. It has beeen abused too long.  \r\nany good news?  \r\nYes, i've opened [Undetected-Discussions](https://github.com/ultrafunkamsterdam/undetected-chromedriver/discussions) which i think will help us better in the long run. \r\n- - -\r\n\r\nWhat this is not\r\n---\r\n**THIS PACKAGE DOES NOT, and i repeat DOES NOT hide your IP address, so when running from a datacenter (even smaller ones), chances are large you will not pass! Also, if your ip reputation at home is low, you won't pass!**\r\n\r\nRunning following code from home , and from a datacenter.\r\n```python\r\nimport undetected_chromedriver as uc\r\ndriver = uc.Chrome(headless=True,use_subprocess=False)\r\ndriver.get('https://nowsecure.nl')\r\ndriver.save_screenshot('nowsecure.png')\r\n```\r\n<div style=\"display:flex;flex-direction:row\">\r\n<img src=\"https://github.com/ultrafunkamsterdam/undetected-chromedriver/assets/21027969/262dad3e-33e9-4d67-b061-b30bc74ac9bc\" width=\"720\"/>\r\n<img src=\"https://github.com/ultrafunkamsterdam/undetected-chromedriver/assets/21027969/5e1d463b-3f88-496a-9a43-a39830f909da\" width=\"720\"/>\r\n  </div>\r\n<!-- ![nowscure_local](https://github.com/ultrafunkamsterdam/undetected-chromedriver/assets/21027969/262dad3e-33e9-4d67-b061-b30bc74ac9bc) -->\r\n<!-- ![nowsecure_dc](https://github.com/ultrafunkamsterdam/undetected-chromedriver/assets/21027969/5e1d463b-3f88-496a-9a43-a39830f909da) -->\r\n\r\n\r\n\r\n## 3.5.0 ##\r\n- selenium 4.10 caused some issues. 3.5.0 is compatible and has selenium 4.9 or above pinned. I can't support <4.9 any longer.\r\n- Removed some kwargs from constructor: service_args, service_creationflags, service_log_path.\r\n- added find_elements_recursive generator function. which is more of a convenience funtion as lots of websites seem to serve different content from different frames, making it hard\r\n  to use find_elements\r\n\r\n\r\n## 3.4.5 ##\r\n- What a week. Had the recent advancedments in Automation-Detection algorithms pwned (so i thought) with 3.4.0, but apparently, for some OS-es this caused an error when    interacting with elements. Had to revert back using a different method, fix bugs, and now eventually was still able to stick to the initial idea (+ fixing bugs)\r\n- Update to chrome 110 caused another surprise, this time for HEADLESS users.\r\n- although headless is unsupported officially, i did patch it!\r\n- happy to announce IT IS NOW UNDETECTED AS WELL (but still unsupported ;))\r\n- special thanks here to [@mdmintz](https://github.com/mdmintz) and [@abdulzain6](https://github.com/abdulzain6)\r\n- also special thanks to [@sebdelsol](https://github.com/sebdelsol) for his help troughout the issues section completely voluntarily, you must be crazy :)\r\n  \r\n### 3.4.0 ###\r\n**Big update! be careful as it -potentially- could break your code.**\r\n\r\n* rewritten the anti-detection mechanism instead of removing and renaming variables, we just keep them, but prevent them from being injected in the first place. This will keep us safe from detection at least for the near future.\r\n\r\n* rewritten the file naming, to prevent ending up with 1000 of {randomstring}_chromedriver.exe 's instead it is just called undetected_chromedriver.exe\r\n\r\n* cleanup removed compat,v2 files and tests folder\r\n\r\n\r\n\r\n\r\n### 3.2.0 ###\r\n\r\n* added an example containing some typical webdriver code, answers to commonly asked questions, pitfalls + showcasing some tricks to ditch\r\n  the need for multithreading.\r\n\r\n### [>>>> example code here <<<<](https://github.com/ultrafunkamsterdam/undetected-chromedriver/blob/master/example/example.py)\r\n\r\n* added WebElement.click_safe() method, which you can try in case you get detected after clicking a link. This is not guaranteed t o work.\r\n\r\n* added WebElement.children(self, tag=None, recursive=False)\r\n  to easily get/find child nodes. example:\r\n    ```\r\n    body = driver.find_element('tag name', 'body')\r\n    \r\n    # get the 6th child (any tag) of body, and grab all img's within (recursive). \r\n    images = body.children()[6].children('img', True)\r\n    srcs = list(map(lambda _:_.attrs.get('src'), images))\r\n    ```\r\n\r\n* added example.py where i can point people at when asking silly questions\r\n  (no, its actually quite cool, everyone should see it)\r\n* added support for lambda platform\r\n* added support for x86_32\r\n* added support for systems reporting as linux2\r\n* some refactoring\r\n\r\n### 3.1.6 ###\r\n\r\n### still passing strong ###\r\n\r\n- use_subprocess now defaults to True. too many people don't understand multiprocessing and __name__ == '__main__, and after testing, it\r\n  seems not to make a difference anymore in chrome 104+\r\n\r\n- added no_sandbox, which defaults to True, and this without the annoying \"you are using unsecure command line ...\" bar.\r\n\r\n- update [Docker image](https://hub.docker.com/r/ultrafunk/undetected-chromedriver). you can now vnc or rdp into your container to see the\r\n  actual browser window\r\n  [![demo](https://i.imgur.com/51Ang6R.gif)](https://i.imgur.com/W7vriN9.mp4)\r\n\r\n- of course, \"regular\" mode works as well\r\n  [![demo](https://i.imgur.com/2qSNyuK.gif)](https://i.imgur.com/2qSNyuK.mp4)\r\n\r\n### 3.1.0 ###\r\n\r\n**this version `might` break your code, test before update!**\r\n\r\n- **added new anti-detection logic!**\r\n\r\n- v2 has become the main module, so no need for references to v2 anymore. this mean you can now simply use:\r\n  ```python\r\n  import undetected_chromedriver as uc\r\n  driver = uc.Chrome()\r\n  driver.get('https://nowsecure.nl')\r\n  ```\r\n  for backwards compatibility, v2 is not removed, but aliassed to the main module.\r\n\r\n- Fixed \"welcome screen\" nagging on non-windows OS-es. For those nagfetishists who ❤ welcome screens and feeding google with even more data,\r\n  use Chrome(suppress_welcome=False).\r\n\r\n- replaced `executable_path` in constructor in favor of `browser_executable_path`\r\n  which should not be used unless you are the edge case (yep, you are) who can't add your custom chrome installation folder to your PATH\r\n  environment variable, or have an army of different browsers/versions and automatic lookup returns the wrong browser\r\n\r\n- \"v1\" (?) moved to _compat for now.\r\n\r\n- fixed dependency versions\r\n\r\n- ChromeOptions custom handling removed, so it is compatible with `webdriver.chromium.options.ChromiumOptions`.\r\n\r\n- removed Chrome.get() fu and restored back to \"almost\" original:\r\n    - no `with` statements needed anymore, although it will still work for the sake of backward-compatibility.\r\n    - no sleeps, stop-start-sessions, delays, or async cdp black magic!\r\n    - this will solve a lot of other \"issues\" as well.\r\n\r\n- test success to date: 100%\r\n\r\n- just to mention it another time, since some people have hard time reading:\r\n  **headless is still WIP. Raising issues is needless**\r\n\r\n# 3.0.4 changes #\r\n\r\n- change process creation behavior to be fully detached\r\n- changed .get(url) method to always use the contextmanager\r\n- changed .get(url) method to use cdp under the hood.\r\n\r\n  ... the `with` statement is not necessary anymore ..\r\n\r\n- todo: work towards asyncification and selenium 4\r\n\r\n#### words of wisdom: ####\r\n\r\nWhenever you encounter the daunted\r\n\r\n```from session not created: This version of ChromeDriver only supports Chrome version 96 # or what ever version```\r\n\r\nthe solution is simple:\r\n\r\n ```python\r\n    import undetected_chromedriver as uc\r\n    driver = uc.Chrome( version_main = 95 )\r\n ```\r\n\r\n**July 2021: Currently busy implementing selenium 4 for undetected-chromedriver**\r\n\r\n**newsflash: https://github.com/ultrafunkamsterdam/undetected-chromedriver/pull/255**\r\n\r\n\r\n\r\n## Usage ##\r\n\r\nTo prevent unnecessary hair-pulling and issue-raising, please mind the **[important note at the end of this document](#important-note) .**\r\n\r\n<br>\r\n\r\n### easy ###\r\n\r\nLiterally, this is all you have to do. Settings are included and your browser executable is found automagically. This is also the snippet i\r\nrecommend using in case you experience an issue.\r\n\r\n```python\r\nimport undetected_chromedriver as uc\r\n\r\n\r\ndriver = uc.Chrome()\r\ndriver.get( 'https://nowsecure.nl' )  # my own test test site with max anti-bot protection\r\n```\r\n\r\n### more advanced way, including setting profie folder ###\r\n\r\nLiterally, this is all you have to do. If a specified folder does not exist, a NEW profile is created. Data dirs which are specified like\r\nthis will not be autoremoved on exit.\r\n\r\n```python\r\nimport undetected_chromedriver as uc\r\n\r\n\r\noptions = uc.ChromeOptions()\r\n\r\n# setting profile\r\noptions.user_data_dir = \"c:\\\\temp\\\\profile\"\r\n\r\n# use specific (older) version\r\ndriver = uc.Chrome(\r\n    options = options , version_main = 94\r\n    )  # version_main allows to specify your chrome version instead of following chrome global version\r\n\r\ndriver.get( 'https://nowsecure.nl' )  # my own test test site with max anti-bot protection\r\n\r\n```\r\n\r\n### expert mode, including Devtool/Wire events  ###\r\n\r\nLiterally, this is all you have to do. You can now listen and subscribe to the low level devtools-protocol. I just recently found out that\r\nis also on planning for future release of the official chromedriver. However i implemented my own for now. Since i needed it myself for\r\ninvestigation.\r\n\r\n```python\r\n\r\nimport undetected_chromedriver as uc\r\nfrom pprint import pformat\r\n\r\ndriver = uc.Chrome(enable_cdp_events=True)\r\n\r\ndef mylousyprintfunction(eventdata):\r\n    print(pformat(eventdata))\r\n    \r\n# set the callback to Network.dataReceived to print (yeah not much original)\r\ndriver.add_cdp_listener(\"Network.dataReceived\", mylousyprintfunction)\r\ndriver.get('https://nowsecure.nl')  # known url using cloudflare's \"under attack mode\"\r\n\r\n\r\ndef mylousyprintfunction(message):\r\n    print(pformat(message))\r\n\r\n\r\n# for more inspiration checkout the link below\r\n# https://chromedevtools.github.io/devtools-protocol/1-3/Network/\r\n\r\n# and of couse 2 lousy examples\r\ndriver.add_cdp_listener('Network.requestWillBeSent', mylousyprintfunction)\r\ndriver.add_cdp_listener('Network.dataReceived', mylousyprintfunction)\r\n\r\n# hint: a wildcard captures all events!\r\n# driver.add_cdp_listener('*', mylousyprintfunction)\r\n\r\n# now all these events will be printed in my console\r\n\r\ndriver.get('https://nowsecure.nl')\r\n\r\n\r\n{'method': 'Network.requestWillBeSent',\r\n 'params': {'documentURL': 'https://nowsecure.nl/',\r\n            'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n            'hasUserGesture': False,\r\n            'initiator': {'type': 'other'},\r\n            'loaderId': '449906A5C736D819123288133F2797E6',\r\n            'request': {'headers': {'Upgrade-Insecure-Requests': '1',\r\n                                    'User-Agent': 'Mozilla/5.0 (Windows NT '\r\n                                                  '10.0; Win64; x64) '\r\n                                                  'AppleWebKit/537.36 (KHTML, '\r\n                                                  'like Gecko) '\r\n                                                  'Chrome/90.0.4430.212 '\r\n                                                  'Safari/537.36',\r\n                                    'sec-ch-ua': '\" Not A;Brand\";v=\"99\", '\r\n                                                 '\"Chromium\";v=\"90\", \"Google '\r\n                                                 'Chrome\";v=\"90\"',\r\n                                    'sec-ch-ua-mobile': '?0'},\r\n                        'initialPriority': 'VeryHigh',\r\n                        'method': 'GET',\r\n                        'mixedContentType': 'none',\r\n                        'referrerPolicy': 'strict-origin-when-cross-origin',\r\n                        'url': 'https://nowsecure.nl/'},\r\n            'requestId': '449906A5C736D819123288133F2797E6',\r\n            'timestamp': 190010.996717,\r\n            'type': 'Document',\r\n            'wallTime': 1621835932.112026}}\r\n{'method': 'Network.requestWillBeSentExtraInfo',\r\n 'params': {'associatedCookies': [],\r\n            'headers': {':authority': 'nowsecure.nl',\r\n                        ':method': 'GET',\r\n                        ':path': '/',\r\n                        ':scheme': 'https',\r\n                        'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',\r\n                        'accept-encoding': 'gzip, deflate, br',\r\n                        'accept-language': 'en-US,en;q=0.9',\r\n                        'sec-ch-ua': '\" Not A;Brand\";v=\"99\", '\r\n                                     '\"Chromium\";v=\"90\", \"Google '\r\n                                     'Chrome\";v=\"90\"',\r\n                        'sec-ch-ua-mobile': '?0',\r\n                        'sec-fetch-dest': 'document',\r\n                        'sec-fetch-mode': 'navigate',\r\n                        'sec-fetch-site': 'none',\r\n                        'sec-fetch-user': '?1',\r\n                        'upgrade-insecure-requests': '1',\r\n                        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; '\r\n                                      'x64) AppleWebKit/537.36 (KHTML, like '\r\n                                      'Gecko) Chrome/90.0.4430.212 '\r\n                                      'Safari/537.36'},\r\n            'requestId': '449906A5C736D819123288133F2797E6'}}\r\n{'method': 'Network.responseReceivedExtraInfo',\r\n 'params': {'blockedCookies': [],\r\n            'headers': {'alt-svc': 'h3-27=\":443\"; ma=86400, h3-28=\":443\"; '\r\n                                   'ma=86400, h3-29=\":443\"; ma=86400',\r\n                        'cache-control': 'private, max-age=0, no-store, '\r\n                                         'no-cache, must-revalidate, '\r\n                                         'post-check=0, pre-check=0',\r\n                        'cf-ray': '65444b779ae6546f-LHR',\r\n                        'cf-request-id': '0a3e8d7eba0000546ffd3fa000000001',\r\n                        'content-type': 'text/html; charset=UTF-8',\r\n                        'date': 'Mon, 24 May 2021 05:58:53 GMT',\r\n                        'expect-ct': 'max-age=604800, '\r\n                                     'report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"',\r\n                        'expires': 'Thu, 01 Jan 1970 00:00:01 GMT',\r\n                        'nel': '{\"report_to\":\"cf-nel\",\"max_age\":604800}',\r\n                        'permissions-policy': 'accelerometer=(),autoplay=(),camera=(),clipboard-read=(),clipboard-write=(),fullscreen=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()',\r\n                        'report-to': '{\"endpoints\":[{\"url\":\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report?s=CAfobYlmWImQ90e%2B4BFBhpPYL%2FyGyBvkcWAj%2B%2FVOLoEq0NVrD5jU9m5pi%2BKI%2BOAnINLPXOCoX2psLphA5Z38aZzWNr3eW%2BDTIK%2FQidc%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}',\r\n                        'server': 'cloudflare',\r\n                        'vary': 'Accept-Encoding',\r\n                        'x-frame-options': 'SAMEORIGIN'},\r\n            'requestId': '449906A5C736D819123288133F2797E6',\r\n            'resourceIPAddressSpace': 'Public'}}\r\n{'method': 'Network.responseReceived',\r\n 'params': {'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n            'loaderId': '449906A5C736D819123288133F2797E6',\r\n            'requestId': '449906A5C736D819123288133F2797E6',\r\n            'response': {'connectionId': 158,\r\n                         'connectionReused': False,\r\n                         'encodedDataLength': 851,\r\n                         'fromDiskCache': False,\r\n                         'fromPrefetchCache': False,\r\n                         'fromServiceWorker': False,\r\n                         'headers': {'alt-svc': 'h3-27=\":443\"; ma=86400, '\r\n                                                'h3-28=\":443\"; ma=86400, '\r\n                                                'h3-29=\":443\"; ma=86400',\r\n                                     'cache-control': 'private, max-age=0, '\r\n                                                      'no-store, no-cache, '\r\n                                                      'must-revalidate, '\r\n                                                      'post-check=0, '\r\n                                                      'pre-check=0',\r\n                                     'cf-ray': '65444b779ae6546f-LHR',\r\n                                     'cf-request-id': '0a3e8d7eba0000546ffd3fa000000001',\r\n                                     'content-type': 'text/html; charset=UTF-8',\r\n                                     'date': 'Mon, 24 May 2021 05:58:53 GMT',\r\n                                     'expect-ct': 'max-age=604800, '\r\n                                                  'report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"',\r\n                                     'expires': 'Thu, 01 Jan 1970 00:00:01 GMT',\r\n                                     'nel': '{\"report_to\":\"cf-nel\",\"max_age\":604800}',\r\n                                     'permissions-policy': 'accelerometer=(),autoplay=(),camera=(),clipboard-read=(),clipboard-write=(),fullscreen=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()',\r\n                                     'report-to': '{\"endpoints\":[{\"url\":\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report?s=CAfobYlmWImQ90e%2B4BFBhpPYL%2FyGyBvkcWAj%2B%2FVOLoEq0NVrD5jU9m5pi%2BKI%2BOAnINLPXOCoX2psLphA5Z38aZzWNr3eW%2BDTIK%2FQidc%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}',\r\n                                     'server': 'cloudflare',\r\n                                     'vary': 'Accept-Encoding',\r\n                                     'x-frame-options': 'SAMEORIGIN'},\r\n                         'mimeType': 'text/html',\r\n                         'protocol': 'h2',\r\n                         'remoteIPAddress': '104.21.5.197',\r\n                         'remotePort': 443,\r\n                         'requestHeaders': {':authority': 'nowsecure.nl',\r\n                                            ':method': 'GET',\r\n                                            ':path': '/',\r\n                                            ':scheme': 'https',\r\n                                            'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',\r\n                                            'accept-encoding': 'gzip, deflate, '\r\n                                                               'br',\r\n                                            'accept-language': 'en-US,en;q=0.9',\r\n                                            'sec-ch-ua': '\" Not '\r\n                                                         'A;Brand\";v=\"99\", '\r\n                                                         '\"Chromium\";v=\"90\", '\r\n                                                         '\"Google '\r\n                                                         'Chrome\";v=\"90\"',\r\n                                            'sec-ch-ua-mobile': '?0',\r\n                                            'sec-fetch-dest': 'document',\r\n                                            'sec-fetch-mode': 'navigate',\r\n                                            'sec-fetch-site': 'none',\r\n                                            'sec-fetch-user': '?1',\r\n                                            'upgrade-insecure-requests': '1',\r\n                                            'user-agent': 'Mozilla/5.0 '\r\n                                                          '(Windows NT 10.0; '\r\n                                                          'Win64; x64) '\r\n                                                          'AppleWebKit/537.36 '\r\n                                                          '(KHTML, like Gecko) '\r\n                                                          'Chrome/90.0.4430.212 '\r\n                                                          'Safari/537.36'},\r\n                         'responseTime': 1621835932177.923,\r\n                         'securityDetails': {'certificateId': 0,\r\n                                             'certificateTransparencyCompliance': 'compliant',\r\n                                             'cipher': 'AES_128_GCM',\r\n                                             'issuer': 'Cloudflare Inc ECC '\r\n                                                       'CA-3',\r\n                                             'keyExchange': '',\r\n                                             'keyExchangeGroup': 'X25519',\r\n                                             'protocol': 'TLS 1.3',\r\n                                             'sanList': ['sni.cloudflaressl.com',\r\n                                                         '*.nowsecure.nl',\r\n                                                         'nowsecure.nl'],\r\n                                             'signedCertificateTimestampList': [{'hashAlgorithm': 'SHA-256',\r\n                                                                                 'logDescription': 'Google '\r\n                                                                                                   \"'Argon2021' \"\r\n                                                                                                   'log',\r\n                                                                                 'logId': 'F65C942FD1773022145418083094568EE34D131933BFDF0C2F200BCC4EF164E3',\r\n                                                                                 'origin': 'Embedded '\r\n                                                                                           'in '\r\n                                                                                           'certificate',\r\n                                                                                 'signatureAlgorithm': 'ECDSA',\r\n                                                                                 'signatureData': '30450221008A25458182A6E7F608FE1492086762A367381E94137952FFD621BA2E60F7E2F702203BCDEBCE1C544DECF0A113DE12B33E299319E6240426F38F08DFC04EF2E42825',\r\n                                                                                 'status': 'Verified',\r\n                                                                                 'timestamp': 1598706372839.0},\r\n                                                                                {'hashAlgorithm': 'SHA-256',\r\n                                                                                 'logDescription': 'DigiCert '\r\n                                                                                                   'Yeti2021 '\r\n                                                                                                   'Log',\r\n                                                                                 'logId': '5CDC4392FEE6AB4544B15E9AD456E61037FBD5FA47DCA17394B25EE6F6C70ECA',\r\n                                                                                 'origin': 'Embedded '\r\n                                                                                           'in '\r\n                                                                                           'certificate',\r\n                                                                                 'signatureAlgorithm': 'ECDSA',\r\n                                                                                 'signatureData': '3046022100A95A49C7435DBFC73406AC409062C27269E6E69F443A2213F3A085E3BCBD234A022100DEA878296F8A1DB43546DC1865A4C5AD2B90664A243AE0A3A6D4925802EE68A8',\r\n                                                                                 'status': 'Verified',\r\n                                                                                 'timestamp': 1598706372823.0}],\r\n                                             'subjectName': 'sni.cloudflaressl.com',\r\n                                             'validFrom': 1598659200,\r\n                                             'validTo': 1630238400},\r\n                         'securityState': 'secure',\r\n                         'status': 503,\r\n                         'statusText': '',\r\n                         'timing': {'connectEnd': 40.414,\r\n                                    'connectStart': 0,\r\n                                    'dnsEnd': 0,\r\n                                    'dnsStart': 0,\r\n                                    'proxyEnd': -1,\r\n                                    'proxyStart': -1,\r\n                                    'pushEnd': 0,\r\n                                    'pushStart': 0,\r\n                                    'receiveHeadersEnd': 60.361,\r\n                                    'requestTime': 190011.002239,\r\n                                    'sendEnd': 41.348,\r\n                                    'sendStart': 41.19,\r\n                                    'sslEnd': 40.405,\r\n                                    'sslStart': 10.853,\r\n                                    'workerFetchStart': -1,\r\n                                    'workerReady': -1,\r\n                                    'workerRespondWithSettled': -1,\r\n                                    'workerStart': -1},\r\n                         'url': 'https://nowsecure.nl/'},\r\n            'timestamp': 190011.06449,\r\n            'type': 'Document'}}\r\n{'method': 'Page.frameStartedLoading',\r\n 'params': {'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700'}}\r\n{'method': 'Page.frameNavigated',\r\n 'params': {'frame': {'adFrameType': 'none',\r\n                      'crossOriginIsolatedContextType': 'NotIsolated',\r\n                      'domainAndRegistry': 'nowsecure.nl',\r\n                      'gatedAPIFeatures': ['SharedArrayBuffers',\r\n                                           'SharedArrayBuffersTransferAllowed'],\r\n                      'id': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n                      'loaderId': '449906A5C736D819123288133F2797E6',\r\n                      'mimeType': 'text/html',\r\n                      'secureContextType': 'Secure',\r\n                      'securityOrigin': 'https://nowsecure.nl',\r\n                      'url': 'https://nowsecure.nl/'}}}\r\n{'method': 'Network.dataReceived',\r\n 'params': {'dataLength': 9835,\r\n            'encodedDataLength': 0,\r\n            'requestId': '449906A5C736D819123288133F2797E6',\r\n            'timestamp': 190011.093343}}\r\n{'method': 'Network.loadingFinished',\r\n 'params': {'encodedDataLength': 10713,\r\n            'requestId': '449906A5C736D819123288133F2797E6',\r\n            'shouldReportCorbBlocking': False,\r\n            'timestamp': 190011.064011}}\r\n{'method': 'Network.requestWillBeSent',\r\n 'params': {'documentURL': 'https://nowsecure.nl/',\r\n            'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n            'hasUserGesture': False,\r\n            'initiator': {'stack': {'callFrames': [{'columnNumber': 51,\r\n                                                    'functionName': '',\r\n                                                    'lineNumber': 114,\r\n                                                    'scriptId': '8',\r\n                                                    'url': 'https://nowsecure.nl/'},\r\n                                                   {'columnNumber': 9,\r\n                                                    'functionName': '',\r\n                                                    'lineNumber': 115,\r\n                                                    'scriptId': '8',\r\n                                                    'url': 'https://nowsecure.nl/'}]},\r\n                          'type': 'script'},\r\n            'loaderId': '449906A5C736D819123288133F2797E6',\r\n            'request': {'headers': {'Referer': 'https://nowsecure.nl/',\r\n                                    'User-Agent': 'Mozilla/5.0 (Windows NT '\r\n                                                  '10.0; Win64; x64) '\r\n                                                  'AppleWebKit/537.36 (KHTML, '\r\n                                                  'like Gecko) '\r\n                                                  'Chrome/90.0.4430.212 '\r\n                                                  'Safari/537.36',\r\n                                    'sec-ch-ua': '\" Not A;Brand\";v=\"99\", '\r\n                                                 '\"Chromium\";v=\"90\", \"Google '\r\n                                                 'Chrome\";v=\"90\"',\r\n                                    'sec-ch-ua-mobile': '?0'},\r\n                        'initialPriority': 'Low',\r\n                        'method': 'GET',\r\n                        'mixedContentType': 'none',\r\n                        'referrerPolicy': 'strict-origin-when-cross-origin',\r\n                        'url': 'https://nowsecure.nl/cdn-cgi/challenge-platform/h/b/orchestrate/jsch/v1?ray=65444b779ae6546f'},\r\n            'requestId': '17180.2',\r\n            'timestamp': 190011.106133,\r\n            'type': 'Script',\r\n            'wallTime': 1621835932.221325}}\r\n{'method': 'Network.requestWillBeSent',\r\n 'params': {'documentURL': 'https://nowsecure.nl/',\r\n            'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n            'hasUserGesture': False,\r\n            'initiator': {'columnNumber': 13,\r\n                          'lineNumber': 117,\r\n                          'type': 'parser',\r\n                          'url': 'https://nowsecure.nl/'},\r\n            'loaderId': '449906A5C736D819123288133F2797E6',\r\n            'request': {'headers': {'Referer': 'https://nowsecure.nl/',\r\n                                    'User-Agent': 'Mozilla/5.0 (Windows NT '\r\n                                                  '10.0; Win64; x64) '\r\n                                                  'AppleWebKit/537.36 (KHTML, '\r\n                                                  'like Gecko) '\r\n                                                  'Chrome/90.0.4430.212 '\r\n                                                  'Safari/537.36',\r\n                                    'sec-ch-ua': '\" Not A;Brand\";v=\"99\", '\r\n                                                 '\"Chromium\";v=\"90\", \"Google '\r\n                                                 'Chrome\";v=\"90\"',\r\n                                    'sec-ch-ua-mobile': '?0'},\r\n                        'initialPriority': 'Low',\r\n                        'method': 'GET',\r\n                        'mixedContentType': 'none',\r\n                        'referrerPolicy': 'strict-origin-when-cross-origin',\r\n                        'url': 'https://nowsecure.nl/cdn-cgi/images/trace/jschal/js/transparent.gif?ray=65444b779ae6546f'},\r\n            'requestId': '17180.3',\r\n            'timestamp': 190011.106911,\r\n            'type': 'Image',\r\n            'wallTime': 1621835932.222102}}\r\n{'method': 'Network.requestWillBeSent',\r\n 'params': {'documentURL': 'https://nowsecure.nl/',\r\n            'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n            'hasUserGesture': False,\r\n            'initiator': {'type': 'parser', 'url': 'https://nowsecure.nl/'},\r\n            'loaderId': '449906A5C736D819123288133F2797E6',\r\n            'request': {'headers': {'Referer': 'https://nowsecure.nl/',\r\n                                    'User-Agent': 'Mozilla/5.0 (Windows NT '\r\n                                                  '10.0; Win64; x64) '\r\n                                                  'AppleWebKit/537.36 (KHTML, '\r\n                                                  'like Gecko) '\r\n                                                  'Chrome/90.0.4430.212 '\r\n                                                  'Safari/537.36',\r\n                                    'sec-ch-ua': '\" Not A;Brand\";v=\"99\", '\r\n                                                 '\"Chromium\";v=\"90\", \"Google '\r\n                                                 'Chrome\";v=\"90\"',\r\n                                    'sec-ch-ua-mobile': '?0'},\r\n                        'initialPriority': 'Low',\r\n                        'method': 'GET',\r\n                        'mixedContentType': 'none',\r\n                        'referrerPolicy': 'strict-origin-when-cross-origin',\r\n                        'url': 'https://nowsecure.nl/cdn-cgi/images/trace/jschal/nojs/transparent.gif?ray=65444b779ae6546f'},\r\n            'requestId': '17180.4',\r\n            'timestamp': 190011.109527,\r\n            'type': 'Image',\r\n            'wallTime': 1621835932.224719}}\r\n{'method': 'Page.domContentEventFired', 'params': {'timestamp': 190011.110345}}\r\n{'method': 'Network.requestWillBeSentExtraInfo',\r\n 'params': {'associatedCookies': [],\r\n            'clientSecurityState': {'initiatorIPAddressSpace': 'Public',\r\n                                    'initiatorIsSecureContext': True,\r\n                                    'privateNetworkRequestPolicy': 'WarnFromInsecureToMorePrivate'},\r\n            'headers': {':authority': 'nowsecure.nl',\r\n                        ':method': 'GET',\r\n                        ':path': '/cdn-cgi/images/trace/jschal/js/transparent.gif?ray=65444b779ae6546f',\r\n                        ':scheme': 'https',\r\n                        'accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',\r\n                        'accept-encoding': 'gzip, deflate, br',\r\n                        'accept-language': 'en-US,en;q=0.9',\r\n                        'referer': 'https://nowsecure.nl/',\r\n                        'sec-ch-ua': '\" Not A;Brand\";v=\"99\", '\r\n                                     '\"Chromium\";v=\"90\", \"Google '\r\n                                     'Chrome\";v=\"90\"',\r\n                        'sec-ch-ua-mobile': '?0',\r\n                        'sec-fetch-dest': 'image',\r\n                        'sec-fetch-mode': 'no-cors',\r\n                        'sec-fetch-site': 'same-origin',\r\n                        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; '\r\n                                      'x64) AppleWebKit/537.36 (KHTML, like '\r\n                                      'Gecko) Chrome/90.0.4430.212 '\r\n                                      'Safari/537.36'},\r\n            'requestId': '17180.3'}}\r\n{'method': 'Network.requestWillBeSentExtraInfo',\r\n 'params': {'associatedCookies': [],\r\n            'clientSecurityState': {'initiatorIPAddressSpace': 'Public',\r\n                                    'initiatorIsSecureContext': True,\r\n                                    'privateNetworkRequestPolicy': 'WarnFromInsecureToMorePrivate'},\r\n            'headers': {':authority': 'nowsecure.nl',\r\n                        ':method': 'GET',\r\n                        ':path': '/cdn-cgi/challenge-platform/h/b/orchestrate/jsch/v1?ray=65444b779ae6546f',\r\n                        ':scheme': 'https',\r\n                        'accept': '*/*',\r\n                        'accept-encoding': 'gzip, deflate, br',\r\n                        'accept-language': 'en-US,en;q=0.9',\r\n                        'referer': 'https://nowsecure.nl/',\r\n                        'sec-ch-ua': '\" Not A;Brand\";v=\"99\", '\r\n                                     '\"Chromium\";v=\"90\", \"Google '\r\n                                     'Chrome\";v=\"90\"',\r\n                        'sec-ch-ua-mobile': '?0',\r\n                        'sec-fetch-dest': 'script',\r\n                        'sec-fetch-mode': 'no-cors',\r\n                        'sec-fetch-site': 'same-origin',\r\n                        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; '\r\n                                      'x64) AppleWebKit/537.36 (KHTML, like '\r\n                                      'Gecko) Chrome/90.0.4430.212 '\r\n                                      'Safari/537.36'},\r\n            'requestId': '17180.2'}}\r\n{'method': 'Network.requestWillBeSentExtraInfo',\r\n 'params': {'associatedCookies': [],\r\n            'clientSecurityState': {'initiatorIPAddressSpace': 'Public',\r\n                                    'initiatorIsSecureContext': True,\r\n                                    'privateNetworkRequestPolicy': 'WarnFromInsecureToMorePrivate'},\r\n            'headers': {':authority': 'nowsecure.nl',\r\n                        ':method': 'GET',\r\n                        ':path': '/cdn-cgi/images/trace/jschal/nojs/transparent.gif?ray=65444b779ae6546f',\r\n                        ':scheme': 'https',\r\n                        'accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',\r\n                        'accept-encoding': 'gzip, deflate, br',\r\n                        'accept-language': 'en-US,en;q=0.9',\r\n                        'referer': 'https://nowsecure.nl/',\r\n                        'sec-ch-ua': '\" Not A;Brand\";v=\"99\", '\r\n                                     '\"Chromium\";v=\"90\", \"Google '\r\n                                     'Chrome\";v=\"90\"',\r\n                        'sec-ch-ua-mobile': '?0',\r\n                        'sec-fetch-dest': 'image',\r\n                        'sec-fetch-mode': 'no-cors',\r\n                        'sec-fetch-site': 'same-origin',\r\n                        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; '\r\n                                      'x64) AppleWebKit/537.36 (KHTML, like '\r\n                                      'Gecko) Chrome/90.0.4430.212 '\r\n                                      'Safari/537.36'},\r\n            'requestId': '17180.4'}}\r\n{'method': 'Network.responseReceivedExtraInfo',\r\n 'params': {'blockedCookies': [],\r\n            'headers': {'accept-ranges': 'bytes',\r\n                        'cache-control': 'max-age=7200\\npublic',\r\n                        'cf-ray': '65444b781d1de604-LHR',\r\n                        'content-length': '42',\r\n                        'content-type': 'image/gif',\r\n                        'date': 'Mon, 24 May 2021 05:58:53 GMT',\r\n                        'etag': '\"60a4d856-2a\"',\r\n                        'expires': 'Mon, 24 May 2021 07:58:53 GMT',\r\n                        'last-modified': 'Wed, 19 May 2021 09:20:22 GMT',\r\n                        'server': 'cloudflare',\r\n                        'vary': 'Accept-Encoding',\r\n                        'x-content-type-options': 'nosniff',\r\n                        'x-frame-options': 'DENY'},\r\n            'requestId': '17180.3',\r\n            'resourceIPAddressSpace': 'Public'}}\r\n{'method': 'Network.responseReceivedExtraInfo',\r\n 'params': {'blockedCookies': [],\r\n            'headers': {'accept-ranges': 'bytes',\r\n                        'cache-control': 'max-age=7200\\npublic',\r\n                        'cf-ray': '65444b781d1fe604-LHR',\r\n                        'content-length': '42',\r\n                        'content-type': 'image/gif',\r\n                        'date': 'Mon, 24 May 2021 05:58:53 GMT',\r\n                        'etag': '\"60a4d856-2a\"',\r\n                        'expires': 'Mon, 24 May 2021 07:58:53 GMT',\r\n                        'last-modified': 'Wed, 19 May 2021 09:20:22 GMT',\r\n                        'server': 'cloudflare',\r\n                        'vary': 'Accept-Encoding',\r\n                        'x-content-type-options': 'nosniff',\r\n                        'x-frame-options': 'DENY'},\r\n            'requestId': '17180.4',\r\n            'resourceIPAddressSpace': 'Public'}}\r\n{'method': 'Network.resourceChangedPriority',\r\n 'params': {'newPriority': 'High',\r\n            'requestId': '17180.4',\r\n            'timestamp': 190011.171057}}\r\n{'method': 'Network.responseReceived',\r\n 'params': {'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n            'loaderId': '449906A5C736D819123288133F2797E6',\r\n            'requestId': '17180.3',\r\n            'response': {'connectionId': 0,\r\n                         'connectionReused': False,\r\n                         'encodedDataLength': 214,\r\n                         'fromDiskCache': False,\r\n                         'fromPrefetchCache': False,\r\n                         'fromServiceWorker': False,\r\n                         'headers': {'accept-ranges': 'bytes',\r\n                                     'cache-control': 'max-age=7200\\npublic',\r\n                                     'cf-ray': '65444b781d1de604-LHR',\r\n                                     'content-length': '42',\r\n                                     'content-type': 'image/gif',\r\n                                     'date': 'Mon, 24 May 2021 05:58:53 GMT',\r\n                                     'etag': '\"60a4d856-2a\"',\r\n                                     'expires': 'Mon, 24 May 2021 07:58:53 GMT',\r\n                                     'last-modified': 'Wed, 19 May 2021 '\r\n                                                      '09:20:22 GMT',\r\n                                     'server': 'cloudflare',\r\n                                     'vary': 'Accept-Encoding',\r\n                                     'x-content-type-options': 'nosniff',\r\n                                     'x-frame-options': 'DENY'},\r\n                         'mimeType': 'image/gif',\r\n                         'protocol': 'h3-29',\r\n                         'remoteIPAddress': '104.21.5.197',\r\n                         'remotePort': 443,\r\n                         'requestHeaders': {':authority': 'nowsecure.nl',\r\n                                            ':method': 'GET',\r\n                                            ':path': '/cdn-cgi/images/trace/jschal/js/transparent.gif?ray=65444b779ae6546f',\r\n                                            ':scheme': 'https',\r\n                                            'accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',\r\n                                            'accept-encoding': 'gzip, deflate, '\r\n                                                               'br',\r\n                                            'accept-language': 'en-US,en;q=0.9',\r\n                                            'referer': 'https://nowsecure.nl/',\r\n                                            'sec-ch-ua': '\" Not '\r\n                                                         'A;Brand\";v=\"99\", '\r\n                                                         '\"Chromium\";v=\"90\", '\r\n                                                         '\"Google '\r\n                                                         'Chrome\";v=\"90\"',\r\n                                            'sec-ch-ua-mobile': '?0',\r\n                                            'sec-fetch-dest': 'image',\r\n                                            'sec-fetch-mode': 'no-cors',\r\n                                            'sec-fetch-site': 'same-origin',\r\n                                            'user-agent': 'Mozilla/5.0 '\r\n                                                          '(Windows NT 10.0; '\r\n                                                          'Win64; x64) '\r\n                                                          'AppleWebKit/537.36 '\r\n                                                          '(KHTML, like Gecko) '\r\n                                                          'Chrome/90.0.4430.212 '\r\n                                                          'Safari/537.36'},\r\n                         'responseTime': 1621835932265.169,\r\n                         'securityDetails': {'certificateId': 0,\r\n                                             'certificateTransparencyCompliance': 'compliant',\r\n                                             'cipher': 'AES_128_GCM',\r\n                                             'issuer': 'Cloudflare Inc ECC '\r\n                                                       'CA-3',\r\n                                             'keyExchange': '',\r\n                                             'keyExchangeGroup': 'X25519',\r\n                                             'protocol': 'QUIC',\r\n                                             'sanList': ['sni.cloudflaressl.com',\r\n                                                         '*.nowsecure.nl',\r\n                                                         'nowsecure.nl'],\r\n                                             'signedCertificateTimestampList': [{'hashAlgorithm': 'SHA-256',\r\n                                                                                 'logDescription': 'Google '\r\n                                                                                                   \"'Argon2021' \"\r\n                                                                                                   'log',\r\n                                                                                 'logId': 'F65C942FD1773022145418083094568EE34D131933BFDF0C2F200BCC4EF164E3',\r\n                                                                                 'origin': 'Embedded '\r\n                                                                                           'in '\r\n                                                                                           'certificate',\r\n                                                                                 'signatureAlgorithm': 'ECDSA',\r\n                                                                                 'signatureData': '30450221008A25458182A6E7F608FE1492086762A367381E94137952FFD621BA2E60F7E2F702203BCDEBCE1C544DECF0A113DE12B33E299319E6240426F38F08DFC04EF2E42825',\r\n                                                                                 'status': 'Verified',\r\n                                                                                 'timestamp': 1598706372839.0},\r\n                                                                                {'hashAlgorithm': 'SHA-256',\r\n                                                                                 'logDescription': 'DigiCert '\r\n                                                                                                   'Yeti2021 '\r\n                                                                                                   'Log',\r\n                                                                                 'logId': '5CDC4392FEE6AB4544B15E9AD456E61037FBD5FA47DCA17394B25EE6F6C70ECA',\r\n                                                                                 'origin': 'Embedded '\r\n                                                                                           'in '\r\n                                                                                           'certificate',\r\n                                                                                 'signatureAlgorithm': 'ECDSA',\r\n                                                                                 'signatureData': '3046022100A95A49C7435DBFC73406AC409062C27269E6E69F443A2213F3A085E3BCBD234A022100DEA878296F8A1DB43546DC1865A4C5AD2B90664A243AE0A3A6D4925802EE68A8',\r\n                                                                                 'status': 'Verified',\r\n                                                                                 'timestamp': 1598706372823.0}],\r\n                                             'subjectName': 'sni.cloudflaressl.com',\r\n                                             'validFrom': 1598659200,\r\n                                             'validTo': 1630238400},\r\n                         'securityState': 'secure',\r\n                         'status': 200,\r\n                         'statusText': '',\r\n                         'timing': {'connectEnd': 26.087,\r\n                                    'connectStart': 0,\r\n                                    'dnsEnd': 0,\r\n                                    'dnsStart': 0,\r\n                                    'proxyEnd': -1,\r\n                                    'proxyStart': -1,\r\n                                    'pushEnd': 0,\r\n                                    'pushStart': 0,\r\n                                    'receiveHeadersEnd': 40.709,\r\n                                    'requestTime': 190011.109386,\r\n                                    'sendEnd': 26.346,\r\n                                    'sendStart': 26.182,\r\n                                    'sslEnd': 26.087,\r\n                                    'sslStart': 0,\r\n                                    'workerFetchStart': -1,\r\n                                    'workerReady': -1,\r\n                                    'workerRespondWithSettled': -1,\r\n                                    'workerStart': -1},\r\n                         'url': 'https://nowsecure.nl/cdn-cgi/images/trace/jschal/js/transparent.gif?ray=65444b779ae6546f'},\r\n            'timestamp': 190011.174536,\r\n            'type': 'Image'}}\r\n{'method': 'Network.dataReceived',\r\n 'params': {'dataLength': 42,\r\n            'encodedDataLength': 0,\r\n            'requestId': '17180.3',\r\n            'timestamp': 190011.174737}}\r\n{'method': 'Network.dataReceived',\r\n 'params': {'dataLength': 0,\r\n            'encodedDataLength': 44,\r\n            'requestId': '17180.3',\r\n            'timestamp': 190011.17524}}\r\n{'method': 'Network.loadingFinished',\r\n 'params': {'encodedDataLength': 258,\r\n            'requestId': '17180.3',\r\n            'shouldReportCorbBlocking': False,\r\n            'timestamp': 190011.152073}}\r\n{'method': 'Network.responseReceived',\r\n 'params': {'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n            'loaderId': '449906A5C736D819123288133F2797E6',\r\n            'requestId': '17180.4',\r\n            'response': {'connectionId': 0,\r\n                         'connectionReused': True,\r\n                         'encodedDataLength': 178,\r\n                         'fromDiskCache': False,\r\n                         'fromPrefetchCache': False,\r\n                         'fromServiceWorker': False,\r\n                         'headers': {'accept-ranges': 'bytes',\r\n                                     'cache-control': 'max-age=7200\\npublic',\r\n                                     'cf-ray': '65444b781d1fe604-LHR',\r\n                                     'content-length': '42',\r\n                                     'content-type': 'image/gif',\r\n                                     'date': 'Mon, 24 May 2021 05:58:53 GMT',\r\n                                     'etag': '\"60a4d856-2a\"',\r\n                                     'expires': 'Mon, 24 May 2021 07:58:53 GMT',\r\n                                     'last-modified': 'Wed, 19 May 2021 '\r\n                                                      '09:20:22 GMT',\r\n                                     'server': 'cloudflare',\r\n                                     'vary': 'Accept-Encoding',\r\n                                     'x-content-type-options': 'nosniff',\r\n                                     'x-frame-options': 'DENY'},\r\n                         'mimeType': 'image/gif',\r\n                         'protocol': 'h3-29',\r\n                         'remoteIPAddress': '104.21.5.197',\r\n                         'remotePort': 443,\r\n                         'requestHeaders': {':authority': 'nowsecure.nl',\r\n                                            ':method': 'GET',\r\n                                            ':path': '/cdn-cgi/images/trace/jschal/nojs/transparent.gif?ray=65444b779ae6546f',\r\n                                            ':scheme': 'https',\r\n                                            'accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',\r\n                                            'accept-encoding': 'gzip, deflate, '\r\n                                                               'br',\r\n                                            'accept-language': 'en-US,en;q=0.9',\r\n                                            'referer': 'https://nowsecure.nl/',\r\n                                            'sec-ch-ua': '\" Not '\r\n                                                         'A;Brand\";v=\"99\", '\r\n                                                         '\"Chromium\";v=\"90\", '\r\n                                                         '\"Google '\r\n                                                         'Chrome\";v=\"90\"',\r\n                                            'sec-ch-ua-mobile': '?0',\r\n                                            'sec-fetch-dest': 'image',\r\n                                            'sec-fetch-mode': 'no-cors',\r\n                                            'sec-fetch-site': 'same-origin',\r\n                                            'user-agent': 'Mozilla/5.0 '\r\n                                                          '(Windows NT 10.0; '\r\n                                                          'Win64; x64) '\r\n                                                          'AppleWebKit/537.36 '\r\n                                                          '(KHTML, like Gecko) '\r\n                                                          'Chrome/90.0.4430.212 '\r\n                                                          'Safari/537.36'},\r\n                         'responseTime': 1621835932268.067,\r\n                         'securityDetails': {'certificateId': 0,\r\n                                             'certificateTransparencyCompliance': 'compliant',\r\n                                             'cipher': 'AES_128_GCM',\r\n                                             'issuer': 'Cloudflare Inc ECC '\r\n                                                       'CA-3',\r\n                                             'keyExchange': '',\r\n                                             'keyExchangeGroup': 'X25519',\r\n                                             'protocol': 'QUIC',\r\n                                             'sanList': ['sni.cloudflaressl.com',\r\n                                                         '*.nowsecure.nl',\r\n                                                         'nowsecure.nl'],\r\n                                             'signedCertificateTimestampList': [{'hashAlgorithm': 'SHA-256',\r\n                                                                                 'logDescription': 'Google '\r\n                                                                                                   \"'Argon2021' \"\r\n                                                                                                   'log',\r\n                                                                                 'logId': 'F65C942FD1773022145418083094568EE34D131933BFDF0C2F200BCC4EF164E3',\r\n                                                                                 'origin': 'Embedded '\r\n                                                                                           'in '\r\n                                                                                           'certificate',\r\n                                                                                 'signatureAlgorithm': 'ECDSA',\r\n                                                                                 'signatureData': '30450221008A25458182A6E7F608FE1492086762A367381E94137952FFD621BA2E60F7E2F702203BCDEBCE1C544DECF0A113DE12B33E299319E6240426F38F08DFC04EF2E42825',\r\n                                                                                 'status': 'Verified',\r\n                                                                                 'timestamp': 1598706372839.0},\r\n                                                                                {'hashAlgorithm': 'SHA-256',\r\n                                                                                 'logDescription': 'DigiCert '\r\n                                                                                                   'Yeti2021 '\r\n                                                                                                   'Log',\r\n                                                                                 'logId': '5CDC4392FEE6AB4544B15E9AD456E61037FBD5FA47DCA17394B25EE6F6C70ECA',\r\n                                                                                 'origin': 'Embedded '\r\n                                                                                           'in '\r\n                                                                                           'certificate',\r\n                                                                                 'signatureAlgorithm': 'ECDSA',\r\n                                                                                 'signatureData': '3046022100A95A49C7435DBFC73406AC409062C27269E6E69F443A2213F3A085E3BCBD234A022100DEA878296F8A1DB43546DC1865A4C5AD2B90664A243AE0A3A6D4925802EE68A8',\r\n                                                                                 'status': 'Verified',\r\n                                                                                 'timestamp': 1598706372823.0}],\r\n                                             'subjectName': 'sni.cloudflaressl.com',\r\n                                             'validFrom': 1598659200,\r\n                                             'validTo': 1630238400},\r\n                         'securityState': 'secure',\r\n                         'status': 200,\r\n                         'statusText': '',\r\n                         'timing': {'connectEnd': -1,\r\n                                    'connectStart': -1,\r\n                                    'dnsEnd': -1,\r\n                                    'dnsStart': -1,\r\n                                    'proxyEnd': -1,\r\n                                    'proxyStart': -1,\r\n                                    'pushEnd': 0,\r\n                                    'pushStart': 0,\r\n                                    'receiveHeadersEnd': 42.415,\r\n                                    'requestTime': 190011.110341,\r\n                                    'sendEnd': 25.713,\r\n                                    'sendStart': 25.609,\r\n                                    'sslEnd': -1,\r\n                                    'sslStart': -1,\r\n                                    'workerFetchStart': -1,\r\n                                    'workerReady': -1,\r\n                                    'workerRespondWithSettled': -1,\r\n                                    'workerStart': -1},\r\n                         'url': 'https://nowsecure.nl/cdn-cgi/images/trace/jschal/nojs/transparent.gif?ray=65444b779ae6546f'},\r\n            'timestamp': 190011.175727,\r\n            'type': 'Image'}}\r\n{'method': 'Network.dataReceived',\r\n 'params': {'dataLength': 42,\r\n            'encodedDataLength': 0,\r\n            'requestId': '17180.4',\r\n            'timestamp': 190011.175856}}\r\n{'method': 'Network.dataReceived',\r\n 'params': {'dataLength': 0,\r\n            'encodedDataLength': 44,\r\n            'requestId': '17180.4',\r\n            'timestamp': 190011.176133}}\r\n{'method': 'Network.loadingFinished',\r\n 'params': {'encodedDataLength': 222,\r\n            'requestId': '17180.4',\r\n            'shouldReportCorbBlocking': False,\r\n            'timestamp': 190011.153335}}\r\n{'method': 'Network.responseReceivedExtraInfo',\r\n 'params': {'blockedCookies': [],\r\n            'headers': {'alt-svc': 'h3-27=\":443\"; ma=86400, h3-28=\":443\"; '\r\n                                   'ma=86400, h3-29=\":443\"; ma=86400',\r\n                        'cache-control': 'max-age=0, must-revalidate',\r\n                        'cf-ray': '65444b781d1ee604-LHR',\r\n                        'cf-request-id': '0a3e8d7f140000e60496387000000001',\r\n                        'content-encoding': 'br',\r\n                        'content-type': 'text/javascript',\r\n                        'date': 'Mon, 24 May 2021 05:58:53 GMT',\r\n                        'expect-ct': 'max-age=604800, '\r\n                                     'report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"',\r\n                        'nel': '{\"report_to\":\"cf-nel\",\"max_age\":604800}',\r\n                        'report-to': '{\"endpoints\":[{\"url\":\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report?s=ZtI%2Bx8B7DpI8%2FsDA72maecFVCPvIsfBOyJjT8weyiqfmrHrmcBYpRhc%2FI%2F6JmIlnxW%2F%2BBohxLi1F8mpjAUabJ0kXLYnmjGKp2Ndio9M%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}',\r\n                        'server': 'cloudflare',\r\n                        'vary': 'Accept-Encoding'},\r\n            'requestId': '17180.2',\r\n            'resourceIPAddressSpace': 'Public'}}\r\n{'method': 'Network.responseReceived',\r\n 'params': {'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n            'loaderId': '449906A5C736D819123288133F2797E6',\r\n            'requestId': '17180.2',\r\n            'response': {'connectionId': 0,\r\n                         'connectionReused': True,\r\n                         'encodedDataLength': 510,\r\n                         'fromDiskCache': False,\r\n                         'fromPrefetchCache': False,\r\n                         'fromServiceWorker': False,\r\n                         'headers': {'alt-svc': 'h3-27=\":443\"; ma=86400, '\r\n                                                'h3-28=\":443\"; ma=86400, '\r\n                                                'h3-29=\":443\"; ma=86400',\r\n                                     'cache-control': 'max-age=0, '\r\n                                                      'must-revalidate',\r\n                                     'cf-ray': '65444b781d1ee604-LHR',\r\n                                     'cf-request-id': '0a3e8d7f140000e60496387000000001',\r\n                                     'content-encoding': 'br',\r\n                                     'content-type': 'text/javascript',\r\n                                     'date': 'Mon, 24 May 2021 05:58:53 GMT',\r\n                                     'expect-ct': 'max-age=604800, '\r\n                                                  'report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"',\r\n                                     'nel': '{\"report_to\":\"cf-nel\",\"max_age\":604800}',\r\n                                     'report-to': '{\"endpoints\":[{\"url\":\"https:\\\\/\\\\/a.nel.cloudflare.com\\\\/report?s=ZtI%2Bx8B7DpI8%2FsDA72maecFVCPvIsfBOyJjT8weyiqfmrHrmcBYpRhc%2FI%2F6JmIlnxW%2F%2BBohxLi1F8mpjAUabJ0kXLYnmjGKp2Ndio9M%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}',\r\n                                     'server': 'cloudflare',\r\n                                     'vary': 'Accept-Encoding'},\r\n                         'mimeType': 'text/javascript',\r\n                         'protocol': 'h3-29',\r\n                         'remoteIPAddress': '104.21.5.197',\r\n                         'remotePort': 443,\r\n                         'requestHeaders': {':authority': 'nowsecure.nl',\r\n                                            ':method': 'GET',\r\n                                            ':path': '/cdn-cgi/challenge-platform/h/b/orchestrate/jsch/v1?ray=65444b779ae6546f',\r\n                                            ':scheme': 'https',\r\n                                            'accept': '*/*',\r\n                                            'accept-encoding': 'gzip, deflate, '\r\n                                                               'br',\r\n                                            'accept-language': 'en-US,en;q=0.9',\r\n                                            'referer': 'https://nowsecure.nl/',\r\n                                            'sec-ch-ua': '\" Not '\r\n                                                         'A;Brand\";v=\"99\", '\r\n                                                         '\"Chromium\";v=\"90\", '\r\n                                                         '\"Google '\r\n                                                         'Chrome\";v=\"90\"',\r\n                                            'sec-ch-ua-mobile': '?0',\r\n                                            'sec-fetch-dest': 'script',\r\n                                            'sec-fetch-mode': 'no-cors',\r\n                                            'sec-fetch-site': 'same-origin',\r\n                                            'user-agent': 'Mozilla/5.0 '\r\n                                                          '(Windows NT 10.0; '\r\n                                                          'Win64; x64) '\r\n                                                          'AppleWebKit/537.36 '\r\n                                                          '(KHTML, like Gecko) '\r\n                                                          'Chrome/90.0.4430.212 '\r\n                                                          'Safari/537.36'},\r\n                         'responseTime': 1621835932301.817,\r\n                         'securityDetails': {'certificateId': 0,\r\n                                             'certificateTransparencyCompliance': 'compliant',\r\n                                             'cipher': 'AES_128_GCM',\r\n                                             'issuer': 'Cloudflare Inc ECC '\r\n                                                       'CA-3',\r\n                                             'keyExchange': '',\r\n                                             'keyExchangeGroup': 'X25519',\r\n                                             'protocol': 'QUIC',\r\n                                             'sanList': ['sni.cloudflaressl.com',\r\n                                                         '*.nowsecure.nl',\r\n                                                         'nowsecure.nl'],\r\n                                             'signedCertificateTimestampList': [{'hashAlgorithm': 'SHA-256',\r\n                                                                                 'logDescription': 'Google '\r\n                                                                                                   \"'Argon2021' \"\r\n                                                                                                   'log',\r\n                                                                                 'logId': 'F65C942FD1773022145418083094568EE34D131933BFDF0C2F200BCC4EF164E3',\r\n                                                                                 'origin': 'Embedded '\r\n                                                                                           'in '\r\n                                                                                           'certificate',\r\n                                                                                 'signatureAlgorithm': 'ECDSA',\r\n                                                                                 'signatureData': '30450221008A25458182A6E7F608FE1492086762A367381E94137952FFD621BA2E60F7E2F702203BCDEBCE1C544DECF0A113DE12B33E299319E6240426F38F08DFC04EF2E42825',\r\n                                                                                 'status': 'Verified',\r\n                                                                                 'timestamp': 1598706372839.0},\r\n                                                                                {'hashAlgorithm': 'SHA-256',\r\n                                                                                 'logDescription': 'DigiCert '\r\n                                                                                                   'Yeti2021 '\r\n                                                                                                   'Log',\r\n                                                                                 'logId': '5CDC4392FEE6AB4544B15E9AD456E61037FBD5FA47DCA17394B25EE6F6C70ECA',\r\n                                                                                 'origin': 'Embedded '\r\n                                                                                           'in '\r\n                                                                                           'certificate',\r\n                                                                                 'signatureAlgorithm': 'ECDSA',\r\n                                                                                 'signatureData': '3046022100A95A49C7435DBFC73406AC409062C27269E6E69F443A2213F3A085E3BCBD234A022100DEA878296F8A1DB43546DC1865A4C5AD2B90664A243AE0A3A6D4925802EE68A8',\r\n                                                                                 'status': 'Verified',\r\n                                                                                 'timestamp': 1598706372823.0}],\r\n                                             'subjectName': 'sni.cloudflaressl.com',\r\n                                             'validFrom': 1598659200,\r\n                                             'validTo': 1630238400},\r\n                         'securityState': 'secure',\r\n                         'status': 200,\r\n                         'statusText': '',\r\n                         'timing': {'connectEnd': -1,\r\n                                    'connectStart': -1,\r\n                                    'dnsEnd': -1,\r\n                                    'dnsStart': -1,\r\n                                    'proxyEnd': -1,\r\n                                    'proxyStart': -1,\r\n                                    'pushEnd': 0,\r\n                                    'pushStart': 0,\r\n                                    'receiveHeadersEnd': 78.885,\r\n                                    'requestTime': 190011.107975,\r\n                                    'sendEnd': 27.934,\r\n                                    'sendStart': 27.809,\r\n                                    'sslEnd': -1,\r\n                                    'sslStart': -1,\r\n                                    'workerFetchStart': -1,\r\n                                    'workerReady': -1,\r\n                                    'workerRespondWithSettled': -1,\r\n                                    'workerStart': -1},\r\n                         'url': 'https://nowsecure.nl/cdn-cgi/challenge-platform/h/b/orchestrate/jsch/v1?ray=65444b779ae6546f'},\r\n            'timestamp': 190011.188468,\r\n            'type': 'Script'}}\r\n{'method': 'Network.dataReceived',\r\n 'params': {'dataLength': 31556,\r\n            'encodedDataLength': 0,\r\n            'requestId': '17180.2',\r\n            'timestamp': 190011.188663}}\r\n{'method': 'Network.dataReceived',\r\n 'params': {'dataLength': 6737,\r\n            'encodedDataLength': 11251,\r\n            'requestId': '17180.2',\r\n            'timestamp': 190011.198249}}\r\n{'method': 'Network.dataReceived',\r\n 'params': {'dataLength': 0,\r\n            'encodedDataLength': 2049,\r\n            'requestId': '17180.2',\r\n            'timestamp': 190011.200943}}\r\n{'method': 'Network.loadingFinished',\r\n 'params': {'encodedDataLength': 13810,\r\n            'requestId': '17180.2',\r\n            'shouldReportCorbBlocking': False,\r\n            'timestamp': 190011.198142}}\r\n{'method': 'Page.loadEventFired', 'params': {'timestamp': 190011.204711}}\r\n{'method': 'Page.frameScheduledNavigation',\r\n 'params': {'delay': 12,\r\n            'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n            'reason': 'metaTagRefresh',\r\n            'url': 'https://nowsecure.nl/'}}\r\n{'method': 'Page.frameStoppedLoading',\r\n 'params': {'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700'}}\r\n{'method': 'Network.requestWillBeSent',\r\n 'params': {'documentURL': 'https://nowsecure.nl/',\r\n            'frameId': 'F42BAE4BDD4E428EE2503CB5A7B4F700',\r\n            'hasUserGesture': False,\r\n            'initiator': {'type': 'other'},\r\n            'loaderId': '449906A5C736D819123288133F2797E6',\r\n            'request': {'headers': {'Referer': 'https://nowsecure.nl/',\r\n                                    'User-Agent': 'Mozilla/5.0 (Windows NT '\r\n                                                  '10.0; Win64; x64) '\r\n                                                  'AppleWebKit/537.36 (KHTML, '\r\n                                                  'like Gecko) '\r\n                                                  'Chrome/90.0.4430.212 '\r\n                                                  'Safari/537.36',\r\n                                    'sec-ch-ua': '\" Not A;Brand\";v=\"99\", '\r\n                                                 '\"Chromium\";v=\"90\", \"Google '\r\n                                                 'Chrome\";v=\"90\"',\r\n                                    'sec-ch-ua-mobile': '?0'},\r\n                        'initialPriority': 'High',\r\n                        'method': 'GET',\r\n                        'mixedContentType': 'none',\r\n                        'referrerPolicy': 'strict-origin-when-cross-origin',\r\n                        'url': 'https://nowsecure.nl/favicon.ico'},\r\n            'requestId': '17180.5',\r\n            'timestamp': 190011.210491,\r\n            'type': 'Other',\r\n            'wallTime': 1621835932.325683}}\r\n{'method': 'Network.requestWillBeSentExtraInfo',\r\n 'params': {'associatedCookies': [{'blockedReasons': [],\r\n                                   'cookie': {'domain': 'nowsecure.nl',\r\n                                              'expires': 1621839532,\r\n                                              'httpOnly': False,\r\n                                              'name': 'cf_chl_prog',\r\n                                              'path': '/',\r\n                                              'priority': 'Medium',\r\n                                              'sameParty': False,\r\n                                              'secure': False,\r\n                                              'session': False,\r\n                                              'size': 12,\r\n                                              'sourcePort': 443,\r\n                                              'sourceScheme': 'Secure',\r\n                                              'value': 'e'}}],\r\n            'clientSecurityState': {'initiatorIPAddressSpace': 'Public',\r\n                                    'initiatorIsSecureContext': True,\r\n                                    'privateNetworkRequestPolicy': 'WarnFromInsecureToMorePrivate'},\r\n            'headers': {':authority': 'nowsecure.nl',\r\n                        ':method': 'GET',\r\n                        ':path': '/favicon.ico',\r\n                        ':scheme': 'https',\r\n                        'accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',\r\n                        'accept-encoding': 'gzip, deflate, br',\r\n                        'accept-language': 'en-US,en;q=0.9',\r\n                        'cookie': 'cf_chl_prog=e',\r\n                        'referer': 'https://nowsecure.nl/',\r\n                        'sec-ch-ua': '\" Not A;Brand\";v=\"99\", '\r\n                                     '\"Chromium\";v=\"90\", \"Google '\r\n                                     'Chrome\";v=\"90\"',\r\n                        'sec-ch-ua-mobile': '?0',\r\n                        'sec-fetch-dest': 'image',\r\n                        'sec-fetch-mode': 'no-cors',\r\n                        'sec-fetch-site': 'same-origin',\r\n                        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; '\r\n                                      'x64) AppleWebKit/537.36 (KHTML, like '\r\n                                      'Gecko) Chrome/90.0.4430.212 '\r\n                                      'Safari/537.36'},\r\n\r\n# hopefullly you get the idea.\r\n```\r\n\r\n<br>\r\n<br>\r\n\r\n#### the easy way (v1 old stuff) ####\r\n\r\n```python\r\nimport undetected_chromedriver as uc\r\n\r\n\r\ndriver = uc.Chrome()\r\ndriver.get( 'https://distilnetworks.com' )\r\n```\r\n\r\n#### target specific chrome version  (v1 old stuff) ####\r\n\r\n```python\r\nimport undetected_chromedriver as uc\r\n\r\n\r\nuc.TARGET_VERSION = 85\r\ndriver = uc.Chrome()\r\n```\r\n\r\n#### monkeypatch mode  (v1 old stuff) ####\r\n\r\nNeeds to be done before importing from selenium package\r\n\r\n```python\r\nimport undetected_chromedriver as uc\r\n\r\n\r\nuc.install()\r\n\r\nfrom selenium.webdriver import Chrome\r\n\r\n\r\ndriver = Chrome()\r\ndriver.get( 'https://distilnetworks.com' )\r\n\r\n```\r\n\r\n#### the customized way  (v1 old stuff) ####\r\n\r\n```python\r\nimport undetected_chromedriver as uc\r\n\r\n\r\n# specify chromedriver version to download and patch\r\nuc.TARGET_VERSION = 78\r\n\r\n# or specify your own chromedriver binary (why you would need this, i don't know)\r\n\r\nuc.install(\r\n    executable_path = 'c:/users/user1/chromedriver.exe' ,\r\n    )\r\n\r\nopts = uc.ChromeOptions()\r\nopts.add_argument( f'--proxy-server=socks5://127.0.0.1:9050' )\r\ndriver = uc.Chrome( options = opts )\r\ndriver.get( 'https://distilnetworks.com' )\r\n```\r\n\r\n#### datadome.co example  (v1 old stuff) ####\r\n\r\nThese guys have actually a powerful product, and a link to this repo, which makes me wanna test their product. Make sure you use a \"clean\"ip\r\nfor this one.\r\n\r\n```python\r\n#\r\n# STANDARD selenium Chromedriver\r\n#\r\nfrom selenium import webdriver\r\n\r\n\r\nchrome = webdriver.Chrome()\r\nchrome.get( 'https://datadome.co/customers-stories/toppreise-ends-web-scraping-and-content-theft-with-datadome/' )\r\nchrome.save_screenshot( 'datadome_regular_webdriver.png' )\r\nTrue  # it caused my ip to be flagged, unfortunately\r\n\r\n#\r\n# UNDETECTED chromedriver (headless,even)\r\n#\r\nimport undetected_chromedriver as uc\r\n\r\n\r\noptions = uc.ChromeOptions()\r\noptions.headless = True\r\noptions.add_argument( '--headless' )\r\nchrome = uc.Chrome( options = options )\r\nchrome.get( 'https://datadome.co/customers-stories/toppreise-ends-web-scraping-and-content-theft-with-datadome/' )\r\nchrome.save_screenshot( 'datadome_undetected_webddriver.png' )\r\n\r\n```\r\n\r\n**Check both saved screenhots [here](https://imgur.com/a/fEmqadP)**\r\n"
  },
  {
    "path": "example/example.py",
    "content": "import time\nimport logging\nlogging.basicConfig(level=10)\n\nfrom selenium.common.exceptions import WebDriverException\nfrom selenium.webdriver.remote.webdriver import By\nimport selenium.webdriver.support.expected_conditions as EC  # noqa\nfrom selenium.webdriver.support.wait import WebDriverWait\n\n\nimport undetected_chromedriver as uc\n\n\ndef main(args=None):\n    TAKE_IT_EASY = True\n\n    if args:\n        TAKE_IT_EASY = (\n            args.no_sleeps\n        )  # so the demo is 'follow-able' instead of some flashes and boom => done. set it how you like\n\n    if TAKE_IT_EASY:\n        sleep = time.sleep\n    else:\n        sleep = lambda n: print(\n            \"we could be sleeping %d seconds here, but we don't\" % n\n        )\n\n    driver = uc.Chrome()\n    driver.get(\"https://www.google.com\")\n\n    # accept the terms\n    driver.find_elements(By.XPATH, '//*[contains(text(), \"Reject all\")]')[\n        -1\n    ].click()  # ;)\n\n    inp_search = driver.find_element(By.XPATH, '//input[@title=\"Search\"]')\n\n    inp_search.send_keys(\n        \"site:stackoverflow.com undetected chromedriver\\n\"\n    )  # \\n as equivalent of ENTER key\n\n    results_container = WebDriverWait(driver, timeout=3).until(\n        EC.presence_of_element_located((By.ID, \"rso\"))\n    )\n\n    driver.execute_script(\n        \"\"\"\n        let container = document.querySelector('#rso');\n        let el = document.createElement('div');\n        el.style = 'width:500px;display:block;background:red;color:white;z-index:999;transition:all 2s ease;padding:1em;font-size:1.5em';\n        el.textContent = \"Excluded from support...!\";\n        container.insertAdjacentElement('afterBegin', el);\n        setTimeout(() => {\n            el.textContent = \"<<<  OH , CHECK YOUR CONSOLE! >>>\"}, 2500)\n        \n    \"\"\"\n    )\n\n    sleep(2)  # never use this. this is for demonstration purposes only\n\n    for item in results_container.children(\"a\", recursive=True):\n        print(item)\n\n    # switching default WebElement for uc.WebElement and do it again\n    driver._web_element_cls = uc.UCWebElement\n\n    print(\"switched to use uc.WebElement. which is more descriptive\")\n    results_container = driver.find_element(By.ID, \"rso\")\n\n    # gets only direct children of results_container\n    # children is a method unique for undetected chromedriver. it is\n    # incompatible when you use regular chromedriver\n    for item in results_container.children():\n        print(item.tag_name)\n        for grandchild in item.children(recursive=True):\n            print(\"\\t\\t\", grandchild.tag_name, \"\\n\\t\\t\\t\", grandchild.text)\n\n    print(\"lets go to image search\")\n    inp_search = driver.find_element(By.XPATH, '//input[@name=\"q\"]')\n    inp_search.clear()\n    inp_search.send_keys(\"hot girls\\n\")  # \\n as equivalent of ENTER\n\n    body = driver.find_element(By.TAG_NAME, \"body\")\n    body.find_elements(By.XPATH, '//a[contains(text(), \"Images\")]')[0].click_safe()\n\n    # you can't reuse the body from above, because we are on another page right now\n    # so the body above is not attached anymore\n    image_search_body = WebDriverWait(driver, 5).until(\n        EC.presence_of_element_located((By.TAG_NAME, \"body\"))\n    )\n\n    # gets all images and prints the src\n    print(\"getting image sources data, hold on...\")\n\n    for item in image_search_body.children(\"img\", recursive=True):\n        print(item.attrs.get(\"src\", item.attrs.get(\"data-src\")), \"\\n\\n\")\n\n    USELESS_SITES = [\n        \"https://www.trumpdonald.org\",\n        \"https://www.isitchristmas.com\",\n        \"https://isnickelbacktheworstbandever.tumblr.com\",\n        \"https://www.isthatcherdeadyet.co.uk\",\n        \"https://whitehouse.gov\",\n        \"https://www.nsa.gov\",\n        \"https://kimjongillookingatthings.tumblr.com\",\n        \"https://instantrimshot.com\",\n        \"https://www.nyan.cat\",\n        \"https://twitter.com\",\n    ]\n\n    print(\"opening 9 additinal windows and control them\")\n    sleep(1)  # never use this. this is for demonstration purposes only\n    for _ in range(9):\n        driver.window_new()\n\n    print(\"now we got 10 windows\")\n    sleep(1)\n    print(\"using the new windows to open 9 other useless sites\")\n    sleep(1)  # never use this. this is for demonstration purposes only\n\n    for idx in range(1, 10):\n        # skip the first handle which is our original window\n        print(\"opening \", USELESS_SITES[idx])\n        driver.switch_to.window(driver.window_handles[idx])\n\n        # because of geographical location, (corporate) firewalls and 1001\n        # other reasons why a connection could be dropped we will use a try/except clause here.\n        try:\n            driver.get(USELESS_SITES[idx])\n        except WebDriverException as e:\n            print(\n                (\n                    \"webdriver exception. this is not an issue in chromedriver, but rather \"\n                    \"an issue specific to your current connection. message:\",\n                    e.args,\n                )\n            )\n            continue\n\n    for handle in driver.window_handles[1:]:\n        driver.switch_to.window(handle)\n        print(\"look. %s is working\" % driver.current_url)\n        sleep(1)  # never use this. it is here only so you can follow along\n\n    print(\n        \"close windows (including the initial one!), but keep the last new opened window\"\n    )\n    sleep(4)  # never use this. wait until nowsecure passed the bot checks\n\n    for handle in driver.window_handles[:-1]:\n        driver.switch_to.window(handle)\n        print(\"look. %s is closing\" % driver.current_url)\n        sleep(1)\n        driver.close()\n\n    # attach to the last open window\n    driver.switch_to.window(driver.window_handles[0])\n    print(\"now we only got \", driver.current_url, \"left\")\n\n    sleep(1)\n\n    driver.get(\"https://www.nowsecure.nl\")\n\n    sleep(5)\n\n    print(\"lets go to UC project page\")\n    driver.get(\"https://www.github.com/ultrafunkamsterdam/undetected-chromedriver\")\n\n    \n    sleep(2)\n    driver.quit()\n\n\nif __name__ == \"__main__\":\n    import argparse\n\n    p = argparse.ArgumentParser()\n    p.add_argument(\"--no-sleeps\", \"-ns\", action=\"store_false\")\n    a = p.parse_args()\n    main(a)\n"
  },
  {
    "path": "example/test_workflow.py",
    "content": "# coding: utf-8\n\nimport time\nimport logging\nimport os\nfrom selenium.webdriver.support.wait import WebDriverWait\nimport selenium.webdriver.support.expected_conditions as EC\nfrom selenium.common.exceptions import TimeoutException\nimport undetected_chromedriver as uc \nfrom pathlib import Path\n\n\nlogging.basicConfig(level=10)\nlogger = logging.getLogger('test')\n\ndef main():\n\n    ####\n    # this block is a dirty helper since \n    # in the action runner devices serveral chrome versions exists\n    # and i need to ensure it takes the one which is installed \n    # by the task.\n    ####\n    \n    for k,v in os.environ.items():\n        logger.info(\"%s = %s\" % (k,v))\n    logger.info('==== END ENV ==== ')\n    tmp = Path('/tmp').resolve()\n    \n    for item in tmp.rglob('**'):    \n        logger.info('found %s ' % item)\n        \n        if item.is_dir():\n            if 'chrome-' in item.name:\n                \n                logger.info('adding %s to PATH' % str(item))\n                logger.info('current PATH: %s' % str(os.environ.get('PATH')))\n                path_list = os.environ['PATH'].split(os.pathsep)\n                path_list.insert(0, str(item))\n                os.environ['PATH'] = os.pathsep.join(path_list)\n                logger.info('new PATH %s:' % str(os.environ.get('PATH')))\n                browser_executable_path = str(item / 'chrome')\n                break\n\n    ####\n    #  test really starts here\n    #3##\n    \n    \n    driver = uc.Chrome(headless=True, browser_executable_path=browser_executable_path)\n    logging.getLogger().setLevel(10)\n    \n    driver.get('chrome://version')\n    \n    driver.save_screenshot('/home/runner/work/_temp/versioninfo.png')\n    \n    driver.get('chrome://settings/help')\n    driver.save_screenshot('/home/runner/work/_temp/helpinfo.png')\n    \n    driver.get('https://www.google.com')\n    driver.save_screenshot('/home/runner/work/_temp/google.com.png')\n    \n    driver.get('https://bot.incolumitas.com/#botChallenge')\n    \n    pdfdata = driver.execute_cdp_cmd('Page.printToPDF', {})\n    if pdfdata:\n        if 'data' in pdfdata:\n            data = pdfdata['data']\n            import base64\n            buffer = base64.b64decode(data)\n            with open('/home/runner/work/_temp/report.pdf', 'w+b') as f:\n                f.write(buffer)\n    \n    driver.get('https://www.nowsecure.nl')\n    \n    logger.info('current url %s' % driver.current_url)\n    \n    try:\n        WebDriverWait(driver,15).until(EC.title_contains('moment'))\n    except TimeoutException:\n        pass\n    \n    logger.info('current page source:\\n%s' % driver.page_source)\n    \n    logger.info('current url %s' % driver.current_url)\n    \n    try:\n        WebDriverWait(driver,15).until(EC.title_contains('nowSecure'))\n        logger.info('PASSED CLOUDFLARE!')\n        \n    except TimeoutException:    \n        logger.info('timeout')\n        print(driver.current_url)\n   \n    logger.info('current page source:\\n%s\\n' % driver.page_source)\n    \n    #logger.info('trying to save a screenshot via imgur')\n   \n    driver.save_screenshot('/home/runner/work/_temp/nowsecure.png')\n    \n    #driver.get('https://imgur.com/upload')\n    \n    #driver.find_element('css selector', 'input').send_keys('/home/runner/work/_temp/nowsecure.png')\n    \n    #time.sleep(1)\n    #logger.info('current url %s' % driver.current_url)\n    #time.sleep(1)\n    #logger.info(f'A SCREENSHOT IS SAVED ON {driver.current_url}  <<< if this ends onlywith /upload than it failed. after all we are running from a datacenter no human being would ever surf the internet from ')\n    #time.sleep(5)\n    \n    driver.quit()\n    \n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "setup.py",
    "content": "\"\"\"\n\n         888                                                  888         d8b\n         888                                                  888         Y8P\n         888                                                  888\n .d8888b 88888b.  888d888 .d88b.  88888b.d88b.   .d88b.   .d88888 888d888 888 888  888  .d88b.  888d888\nd88P\"    888 \"88b 888P\"  d88\"\"88b 888 \"888 \"88b d8P  Y8b d88\" 888 888P\"   888 888  888 d8P  Y8b 888P\"\n888      888  888 888    888  888 888  888  888 88888888 888  888 888     888 Y88  88P 88888888 888\nY88b.    888  888 888    Y88..88P 888  888  888 Y8b.     Y88b 888 888     888  Y8bd8P  Y8b.     888\n \"Y8888P 888  888 888     \"Y88P\"  888  888  888  \"Y8888   \"Y88888 888     888   Y88P    \"Y8888  888   88888888\n\nBY ULTRAFUNKAMSTERDAM (https://github.com/ultrafunkamsterdam)\"\"\"\n\nimport os\nimport re\n\nfrom setuptools import setup\n\n\ndirname = os.path.abspath(os.path.dirname(__file__))\n\nwith open(\n    os.path.join(dirname, \"undetected_chromedriver\", \"__init__.py\"),\n    mode=\"r\",\n    encoding=\"utf-8\",\n) as fp:\n    try:\n        version = re.findall(r\"^__version__ = ['\\\"]([^'\\\"]*)['\\\"]\", fp.read(), re.M)[0]\n    except Exception:\n        raise RuntimeError(\"unable to determine version\")\n\ndescription = (\n    \"Selenium.webdriver.Chrome replacement with compatiblity for Brave, and other Chromium based browsers.\",\n    \"Not triggered by CloudFlare/Imperva/hCaptcha and such.\",\n    \"NOTE: results may vary due to many factors. No guarantees are given, except for ongoing efforts in understanding detection algorithms.\",\n)\n\nsetup(\n    name=\"undetected-chromedriver\",\n    version=version,\n    packages=[\"undetected_chromedriver\"],\n    install_requires=[\n        \"selenium>=4.18.1\",  # Updated to latest as of Mar 2024\n        \"requests>=2.31.0\",  # Updated to latest as of Mar 2024\n        \"websockets>=12.0\",  # Updated to latest as of Mar 2024\n        \"packaging>=23.0\", # Specify a recent version\n    ],\n    package_data={\"undetected_chromedriver\": [os.path.join(\"example\", \"example.py\")]},\n    url=\"https://github.com/ultrafunkamsterdam/undetected-chromedriver\",\n    license=\"GPL-3.0\",\n    author=\"UltrafunkAmsterdam\",\n    author_email=\"info@blackhat-security.nl\",\n    description=description,\n    long_description=open(os.path.join(dirname, \"README.md\"), encoding=\"utf-8\").read(),\n    long_description_content_type=\"text/markdown\",\n    classifiers=[\n        \"License :: OSI Approved :: GNU General Public License v3 (GPLv3)\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Programming Language :: Python :: 3.11\",\n        \"Programming Language :: Python :: 3.12\", # Assuming 3.12 is also supported\n        \"Programming Language :: Python :: 3.13\",\n    ],\n)\n"
  },
  {
    "path": "undetected_chromedriver/__init__.py",
    "content": "#!/usr/bin/env python3\n\n\"\"\"\n\n         888                                                  888         d8b\n         888                                                  888         Y8P\n         888                                                  888\n .d8888b 88888b.  888d888 .d88b.  88888b.d88b.   .d88b.   .d88888 888d888 888 888  888  .d88b.  888d888\nd88P\"    888 \"88b 888P\"  d88\"\"88b 888 \"888 \"88b d8P  Y8b d88\" 888 888P\"   888 888  888 d8P  Y8b 888P\"\n888      888  888 888    888  888 888  888  888 88888888 888  888 888     888 Y88  88P 88888888 888\nY88b.    888  888 888    Y88..88P 888  888  888 Y8b.     Y88b 888 888     888  Y8bd8P  Y8b.     888\n \"Y8888P 888  888 888     \"Y88P\"  888  888  888  \"Y8888   \"Y88888 888     888   Y88P    \"Y8888  888   88888888\n\nby UltrafunkAmsterdam (https://github.com/ultrafunkamsterdam)\n\n\"\"\"\nfrom __future__ import annotations\n\n\n__version__ = \"3.5.5\"\n\nimport json\nimport logging\nimport os\nimport pathlib\nimport re\nimport shutil\nimport subprocess\nimport sys\nimport tempfile\nimport time\nfrom weakref import finalize\n\nimport selenium.webdriver.chrome.service\nimport selenium.webdriver.chrome.webdriver\nfrom selenium.webdriver.common.by import By\nimport selenium.webdriver.chromium.service\nimport selenium.webdriver.remote.command\nimport selenium.webdriver.remote.webdriver\n\nfrom .cdp import CDP\nfrom .dprocess import start_detached\nfrom .options import ChromeOptions\nfrom .patcher import IS_POSIX\nfrom .patcher import Patcher\nfrom .reactor import Reactor\nfrom .webelement import UCWebElement\nfrom .webelement import WebElement\n\n\n__all__ = (\n    \"Chrome\",\n    \"ChromeOptions\",\n    \"Patcher\",\n    \"Reactor\",\n    \"CDP\",\n    \"find_chrome_executable\",\n)\n\nlogger = logging.getLogger(\"uc\")\nlogger.setLevel(logging.getLogger().getEffectiveLevel())\n\n\nclass Chrome(selenium.webdriver.chrome.webdriver.WebDriver):\n    \"\"\"\n\n    Controls the ChromeDriver and allows you to drive the browser.\n\n    The webdriver file will be downloaded by this module automatically,\n    you do not need to specify this. however, you may if you wish.\n\n    Attributes\n    ----------\n\n    Methods\n    -------\n\n    reconnect()\n\n        this can be useful in case of heavy detection methods\n        -stops the chromedriver service which runs in the background\n        -starts the chromedriver service which runs in the background\n        -recreate session\n\n\n    start_session(capabilities=None, browser_profile=None)\n\n        differentiates from the regular method in that it does not\n        require a capabilities argument. The capabilities are automatically\n        recreated from the options at creation time.\n\n    --------------------------------------------------------------------------\n        NOTE:\n            Chrome has everything included to work out of the box.\n            it does not `need` customizations.\n            any customizations MAY lead to trigger bot migitation systems.\n\n    --------------------------------------------------------------------------\n    \"\"\"\n\n    _instances = set()\n    session_id = None\n    debug = False\n\n    def __init__(\n        self,\n        options=None,\n        user_data_dir=None,\n        driver_executable_path=None,\n        browser_executable_path=None,\n        port=0,\n        enable_cdp_events=False,\n        # service_args=None,\n        # service_creationflags=None,\n        desired_capabilities=None,\n        advanced_elements=False,\n        # service_log_path=None,\n        keep_alive=True,\n        log_level=0,\n        headless=False,\n        version_main=None,\n        patcher_force_close=False,\n        suppress_welcome=True,\n        use_subprocess=True,\n        debug=False,\n        no_sandbox=True,\n        user_multi_procs: bool = False,\n        **kw,\n    ):\n        \"\"\"\n        Creates a new instance of the chrome driver.\n\n        Starts the service and then creates new instance of chrome driver.\n\n        Parameters\n        ----------\n\n        options: ChromeOptions, optional, default: None - automatic useful defaults\n            this takes an instance of ChromeOptions, mainly to customize browser behavior.\n            anything other dan the default, for example extensions or startup options\n            are not supported in case of failure, and can probably lowers your undetectability.\n\n\n        user_data_dir: str , optional, default: None (creates temp profile)\n            if user_data_dir is a path to a valid chrome profile directory, use it,\n            and turn off automatic removal mechanism at exit.\n\n        driver_executable_path: str, optional, default: None(=downloads and patches new binary)\n\n        browser_executable_path: str, optional, default: None - use find_chrome_executable\n            Path to the browser executable.\n            If not specified, make sure the executable's folder is in $PATH\n\n        port: int, optional, default: 0\n            port to be used by the chromedriver executable, this is NOT the debugger port.\n            leave it at 0 unless you know what you are doing.\n            the default value of 0 automatically picks an available port.\n\n        enable_cdp_events: bool, default: False\n            :: currently for chrome only\n            this enables the handling of wire messages\n            when enabled, you can subscribe to CDP events by using:\n\n                driver.add_cdp_listener(\"Network.dataReceived\", yourcallback)\n                # yourcallback is an callable which accepts exactly 1 dict as parameter\n\n\n        service_args: list of str, optional, default: None\n            arguments to pass to the driver service\n\n        desired_capabilities: dict, optional, default: None - auto from config\n            Dictionary object with non-browser specific capabilities only, such as \"item\" or \"loggingPref\".\n\n        advanced_elements:  bool, optional, default: False\n            makes it easier to recognize elements like you know them from html/browser inspection, especially when working\n            in an interactive environment\n\n            default webelement repr:\n            <selenium.webdriver.remote.webelement.WebElement (session=\"85ff0f671512fa535630e71ee951b1f2\", element=\"6357cb55-92c3-4c0f-9416-b174f9c1b8c4\")>\n\n            advanced webelement repr\n            <WebElement(<a class=\"mobile-show-inline-block mc-update-infos init-ok\" href=\"#\" id=\"main-cat-switcher-mobile\">)>\n\n            note: when retrieving large amounts of elements ( example: find_elements_by_tag(\"*\") ) and print them, it does take a little more time.\n\n\n        service_log_path: str, optional, default: None\n             path to log information from the driver.\n\n        keep_alive: bool, optional, default: True\n             Whether to configure ChromeRemoteConnection to use HTTP keep-alive.\n\n        log_level: int, optional, default: adapts to python global log level\n\n        headless: bool, optional, default: False\n            can also be specified in the options instance.\n            Specify whether you want to use the browser in headless mode.\n            warning: this lowers undetectability and not fully supported.\n\n        version_main: int, optional, default: None (=auto)\n            if you, for god knows whatever reason, use\n            an older version of Chrome. You can specify it's full rounded version number\n            here. Example: 87 for all versions of 87\n\n        patcher_force_close: bool, optional, default: False\n            instructs the patcher to do whatever it can to access the chromedriver binary\n            if the file is locked, it will force shutdown all instances.\n            setting it is not recommended, unless you know the implications and think\n            you might need it.\n\n        suppress_welcome: bool, optional , default: True\n            a \"welcome\" alert might show up on *nix-like systems asking whether you want to set\n            chrome as your default browser, and if you want to send even more data to google.\n            now, in case you are nag-fetishist, or a diagnostics data feeder to google, you can set this to False.\n            Note: if you don't handle the nag screen in time, the browser loses it's connection and throws an Exception.\n\n        use_subprocess: bool, optional , default: True,\n\n            False (the default) makes sure Chrome will get it's own process (so no subprocess of chromedriver.exe or python\n                This fixes a LOT of issues, like multithreaded run, but mst importantly. shutting corectly after\n                program exits or using .quit()\n                you should be knowing what you're doing, and know how python works.\n\n              unfortunately, there  is always an edge case in which one would like to write an single script with the only contents being:\n              --start script--\n              import undetected_chromedriver as uc\n              d = uc.Chrome()\n              d.get('https://somesite/')\n              ---end script --\n\n              and will be greeted with an error, since the program exists before chrome has a change to launch.\n              in that case you can set this to `True`. The browser will start via subprocess, and will keep running most of times.\n              ! setting it to True comes with NO support when being detected. !\n\n        no_sandbox: bool, optional, default=True\n             uses the --no-sandbox option, and additionally does suppress the \"unsecure option\" status bar\n             this option has a default of True since many people seem to run this as root (....) , and chrome does not start\n             when running as root without using --no-sandbox flag.\n\n        user_multi_procs:\n            set to true when you are using multithreads/multiprocessing\n            ensures not all processes are trying to modify a binary which is in use by another.\n            for this to work. YOU MUST HAVE AT LEAST 1 UNDETECTED_CHROMEDRIVER BINARY IN YOUR ROAMING DATA FOLDER.\n            this requirement can be easily satisfied, by just running this program \"normal\" and close/kill it.\n\n\n        \"\"\"\n\n        finalize(self, self._ensure_close, self)\n        self.debug = debug\n        self.patcher = Patcher(\n            executable_path=driver_executable_path,\n            force=patcher_force_close,\n            version_main=version_main,\n            user_multi_procs=user_multi_procs,\n        )\n        # self.patcher.auto(user_multiprocess = user_multi_num_procs)\n        self.patcher.auto()\n\n        # self.patcher = patcher\n        if not options:\n            options = ChromeOptions()\n\n        try:\n            if hasattr(options, \"_session\") and options._session is not None:\n                #  prevent reuse of options,\n                #  as it just appends arguments, not replace them\n                #  you'll get conflicts starting chrome\n                raise RuntimeError(\"you cannot reuse the ChromeOptions object\")\n        except AttributeError:\n            pass\n\n        options._session = self\n\n        if not options.debugger_address:\n            debug_port = (\n                port\n                if port != 0\n                else selenium.webdriver.common.service.utils.free_port()\n            )\n            debug_host = \"127.0.0.1\"\n            options.debugger_address = \"%s:%d\" % (debug_host, debug_port)\n        else:\n            debug_host, debug_port = options.debugger_address.split(\":\")\n            debug_port = int(debug_port)\n\n        if enable_cdp_events:\n            options.set_capability(\n                \"goog:loggingPrefs\", {\"performance\": \"ALL\", \"browser\": \"ALL\"}\n            )\n\n        options.add_argument(\"--remote-debugging-host=%s\" % debug_host)\n        options.add_argument(\"--remote-debugging-port=%s\" % debug_port)\n\n        if user_data_dir:\n            options.add_argument(\"--user-data-dir=%s\" % user_data_dir)\n\n        language, keep_user_data_dir = None, bool(user_data_dir)\n\n        # see if a custom user profile is specified in options\n        for arg in options.arguments:\n\n            if any([_ in arg for _ in (\"--headless\", \"headless\")]):\n                options.arguments.remove(arg)\n                options.headless = True\n\n            if \"lang\" in arg:\n                m = re.search(\"(?:--)?lang(?:[ =])?(.*)\", arg)\n                try:\n                    language = m[1]\n                except IndexError:\n                    logger.debug(\"will set the language to en-US,en;q=0.9\")\n                    language = \"en-US,en;q=0.9\"\n\n            if \"user-data-dir\" in arg:\n                m = re.search(\"(?:--)?user-data-dir(?:[ =])?(.*)\", arg)\n                try:\n                    user_data_dir = m[1]\n                    logger.debug(\n                        \"user-data-dir found in user argument %s => %s\" % (arg, m[1])\n                    )\n                    keep_user_data_dir = True\n\n                except IndexError:\n                    logger.debug(\n                        \"no user data dir could be extracted from supplied argument %s \"\n                        % arg\n                    )\n\n        if not user_data_dir:\n            # backward compatiblity\n            # check if an old uc.ChromeOptions is used, and extract the user data dir\n\n            if hasattr(options, \"user_data_dir\") and getattr(\n                options, \"user_data_dir\", None\n            ):\n                import warnings\n\n                warnings.warn(\n                    \"using ChromeOptions.user_data_dir might stop working in future versions.\"\n                    \"use uc.Chrome(user_data_dir='/xyz/some/data') in case you need existing profile folder\"\n                )\n                options.add_argument(\"--user-data-dir=%s\" % options.user_data_dir)\n                keep_user_data_dir = True\n                logger.debug(\n                    \"user_data_dir property found in options object: %s\" % user_data_dir\n                )\n\n            else:\n                user_data_dir = os.path.normpath(tempfile.mkdtemp())\n                keep_user_data_dir = False\n                arg = \"--user-data-dir=%s\" % user_data_dir\n                options.add_argument(arg)\n                logger.debug(\n                    \"created a temporary folder in which the user-data (profile) will be stored during this\\n\"\n                    \"session, and added it to chrome startup arguments: %s\" % arg\n                )\n\n        if not language:\n            try:\n                import locale\n\n                language = locale.getdefaultlocale()[0].replace(\"_\", \"-\")\n            except Exception:\n                pass\n            if not language:\n                language = \"en-US\"\n\n        options.add_argument(\"--lang=%s\" % language)\n\n        if not options.binary_location:\n            options.binary_location = (\n                browser_executable_path or find_chrome_executable()\n            )\n\n        if not options.binary_location or not \\\n                pathlib.Path(options.binary_location).exists():\n                raise FileNotFoundError(\n                    \"\\n---------------------\\n\"\n                    \"Could not determine browser executable.\"\n                    \"\\n---------------------\\n\"\n                    \"Make sure your browser is installed in the default location (path).\\n\"\n                    \"If you are sure about the browser executable, you can specify it using\\n\"\n                    \"the `browser_executable_path='{}` parameter.\\n\\n\"\n                    .format(\"/path/to/browser/executable\" if IS_POSIX else \"c:/path/to/your/browser.exe\")\n                )\n\n        self._delay = 3\n\n        self.user_data_dir = user_data_dir\n        self.keep_user_data_dir = keep_user_data_dir\n\n        if suppress_welcome:\n            options.arguments.extend([\"--no-default-browser-check\", \"--no-first-run\"])\n        if no_sandbox:\n            options.arguments.extend([\"--no-sandbox\", \"--test-type\"])\n\n        if headless or getattr(options, 'headless', None):\n            #workaround until a better checking is found\n            try:\n                if self.patcher.version_main < 108:\n                    options.add_argument(\"--headless=chrome\")\n                elif self.patcher.version_main >= 108:\n                    options.add_argument(\"--headless=new\")\n            except:\n                logger.warning(\"could not detect version_main.\"\n                               \"therefore, we are assuming it is chrome 108 or higher\")\n                options.add_argument(\"--headless=new\")\n\n        options.add_argument(\"--window-size=1920,1080\")\n        options.add_argument(\"--start-maximized\")\n        options.add_argument(\"--no-sandbox\")\n        # fixes \"could not connect to chrome\" error when running\n        # on linux using privileged user like root (which i don't recommend)\n\n        options.add_argument(\n            \"--log-level=%d\" % log_level\n            or divmod(logging.getLogger().getEffectiveLevel(), 10)[0]\n        )\n\n        if hasattr(options, \"handle_prefs\"):\n            options.handle_prefs(user_data_dir)\n\n        # fix exit_type flag to prevent tab-restore nag\n        try:\n            with open(\n                os.path.join(user_data_dir, \"Default/Preferences\"),\n                encoding=\"latin1\",\n                mode=\"r+\",\n            ) as fs:\n                config = json.load(fs)\n                if config[\"profile\"][\"exit_type\"] is not None:\n                    # fixing the restore-tabs-nag\n                    config[\"profile\"][\"exit_type\"] = None\n                fs.seek(0, 0)\n                json.dump(config, fs)\n                fs.truncate()  # the file might be shorter\n                logger.debug(\"fixed exit_type flag\")\n        except Exception as e:\n            logger.debug(\"did not find a bad exit_type flag \")\n\n        self.options = options\n\n        if not desired_capabilities:\n            desired_capabilities = options.to_capabilities()\n\n        if not use_subprocess:\n            self.browser_pid = start_detached(\n                options.binary_location, *options.arguments\n            )\n        else:\n            browser = subprocess.Popen(\n                [options.binary_location, *options.arguments],\n                stdin=subprocess.PIPE,\n                stdout=subprocess.PIPE,\n                stderr=subprocess.PIPE,\n                close_fds=IS_POSIX,\n            )\n            self.browser_pid = browser.pid\n\n\n        service = selenium.webdriver.chromium.service.ChromiumService(\n            self.patcher.executable_path\n        )\n\n        super().__init__(\n            service=service,\n            options=options,\n            keep_alive=keep_alive,\n        )\n\n        self.reactor = None\n\n        if enable_cdp_events:\n            if logging.getLogger().getEffectiveLevel() == logging.DEBUG:\n                logging.getLogger(\n                    \"selenium.webdriver.remote.remote_connection\"\n                ).setLevel(20)\n            reactor = Reactor(self)\n            reactor.start()\n            self.reactor = reactor\n\n        if advanced_elements:\n            self._web_element_cls = UCWebElement\n        else:\n            self._web_element_cls = WebElement\n\n        if headless or getattr(options, 'headless', None):\n            self._configure_headless()\n\n    def _configure_headless(self):\n        orig_get = self.get\n        logger.info(\"setting properties for headless\")\n\n        def get_wrapped(*args, **kwargs):\n            if self.execute_script(\"return navigator.webdriver\"):\n                logger.info(\"patch navigator.webdriver\")\n                self.execute_cdp_cmd(\n                    \"Page.addScriptToEvaluateOnNewDocument\",\n                    {\n                        \"source\": \"\"\"\n\n                           Object.defineProperty(window, \"navigator\", {\n                                Object.defineProperty(window, \"navigator\", {\n                                  value: new Proxy(navigator, {\n                                    has: (target, key) => (key === \"webdriver\" ? false : key in target),\n                                    get: (target, key) =>\n                                      key === \"webdriver\"\n                                        ? false\n                                        : typeof target[key] === \"function\"\n                                        ? target[key].bind(target)\n                                        : target[key],\n                                  }),\n                                });\n                    \"\"\"\n                    },\n                )\n\n                logger.info(\"patch user-agent string\")\n                self.execute_cdp_cmd(\n                    \"Network.setUserAgentOverride\",\n                    {\n                        \"userAgent\": self.execute_script(\n                            \"return navigator.userAgent\"\n                        ).replace(\"Headless\", \"\")\n                    },\n                )\n                self.execute_cdp_cmd(\n                    \"Page.addScriptToEvaluateOnNewDocument\",\n                    {\n                        \"source\": \"\"\"\n                            Object.defineProperty(navigator, 'maxTouchPoints', {get: () => 1});\n                            Object.defineProperty(navigator.connection, 'rtt', {get: () => 100});\n\n                            // https://github.com/microlinkhq/browserless/blob/master/packages/goto/src/evasions/chrome-runtime.js\n                            window.chrome = {\n                                app: {\n                                    isInstalled: false,\n                                    InstallState: {\n                                        DISABLED: 'disabled',\n                                        INSTALLED: 'installed',\n                                        NOT_INSTALLED: 'not_installed'\n                                    },\n                                    RunningState: {\n                                        CANNOT_RUN: 'cannot_run',\n                                        READY_TO_RUN: 'ready_to_run',\n                                        RUNNING: 'running'\n                                    }\n                                },\n                                runtime: {\n                                    OnInstalledReason: {\n                                        CHROME_UPDATE: 'chrome_update',\n                                        INSTALL: 'install',\n                                        SHARED_MODULE_UPDATE: 'shared_module_update',\n                                        UPDATE: 'update'\n                                    },\n                                    OnRestartRequiredReason: {\n                                        APP_UPDATE: 'app_update',\n                                        OS_UPDATE: 'os_update',\n                                        PERIODIC: 'periodic'\n                                    },\n                                    PlatformArch: {\n                                        ARM: 'arm',\n                                        ARM64: 'arm64',\n                                        MIPS: 'mips',\n                                        MIPS64: 'mips64',\n                                        X86_32: 'x86-32',\n                                        X86_64: 'x86-64'\n                                    },\n                                    PlatformNaclArch: {\n                                        ARM: 'arm',\n                                        MIPS: 'mips',\n                                        MIPS64: 'mips64',\n                                        X86_32: 'x86-32',\n                                        X86_64: 'x86-64'\n                                    },\n                                    PlatformOs: {\n                                        ANDROID: 'android',\n                                        CROS: 'cros',\n                                        LINUX: 'linux',\n                                        MAC: 'mac',\n                                        OPENBSD: 'openbsd',\n                                        WIN: 'win'\n                                    },\n                                    RequestUpdateCheckStatus: {\n                                        NO_UPDATE: 'no_update',\n                                        THROTTLED: 'throttled',\n                                        UPDATE_AVAILABLE: 'update_available'\n                                    }\n                                }\n                            }\n\n                            // https://github.com/microlinkhq/browserless/blob/master/packages/goto/src/evasions/navigator-permissions.js\n                            if (!window.Notification) {\n                                window.Notification = {\n                                    permission: 'denied'\n                                }\n                            }\n\n                            const originalQuery = window.navigator.permissions.query\n                            window.navigator.permissions.__proto__.query = parameters =>\n                                parameters.name === 'notifications'\n                                    ? Promise.resolve({ state: window.Notification.permission })\n                                    : originalQuery(parameters)\n\n                            const oldCall = Function.prototype.call\n                            function call() {\n                                return oldCall.apply(this, arguments)\n                            }\n                            Function.prototype.call = call\n\n                            const nativeToStringFunctionString = Error.toString().replace(/Error/g, 'toString')\n                            const oldToString = Function.prototype.toString\n\n                            function functionToString() {\n                                if (this === window.navigator.permissions.query) {\n                                    return 'function query() { [native code] }'\n                                }\n                                if (this === functionToString) {\n                                    return nativeToStringFunctionString\n                                }\n                                return oldCall.call(oldToString, this)\n                            }\n                            // eslint-disable-next-line\n                            Function.prototype.toString = functionToString\n                            \"\"\"\n                    },\n                )\n            return orig_get(*args, **kwargs)\n\n        self.get = get_wrapped\n\n    # def _get_cdc_props(self):\n    #     return self.execute_script(\n    #         \"\"\"\n    #         let objectToInspect = window,\n    #             result = [];\n    #         while(objectToInspect !== null)\n    #         { result = result.concat(Object.getOwnPropertyNames(objectToInspect));\n    #           objectToInspect = Object.getPrototypeOf(objectToInspect); }\n    #\n    #         return result.filter(i => i.match(/^([a-zA-Z]){27}(Array|Promise|Symbol)$/ig))\n    #         \"\"\"\n    #     )\n    #\n    # def _hook_remove_cdc_props(self):\n    #     self.execute_cdp_cmd(\n    #         \"Page.addScriptToEvaluateOnNewDocument\",\n    #         {\n    #             \"source\": \"\"\"\n    #                 let objectToInspect = window,\n    #                     result = [];\n    #                 while(objectToInspect !== null)\n    #                 { result = result.concat(Object.getOwnPropertyNames(objectToInspect));\n    #                   objectToInspect = Object.getPrototypeOf(objectToInspect); }\n    #                 result.forEach(p => p.match(/^([a-zA-Z]){27}(Array|Promise|Symbol)$/ig)\n    #                                     &&delete window[p]&&console.log('removed',p))\n    #                 \"\"\"\n    #         },\n    #     )\n\n    def get(self, url):\n        # if self._get_cdc_props():\n        #     self._hook_remove_cdc_props()\n        return super().get(url)\n\n    def add_cdp_listener(self, event_name, callback):\n        if (\n            self.reactor\n            and self.reactor is not None\n            and isinstance(self.reactor, Reactor)\n        ):\n            self.reactor.add_event_handler(event_name, callback)\n            return self.reactor.handlers\n        return False\n\n    def clear_cdp_listeners(self):\n        if self.reactor and isinstance(self.reactor, Reactor):\n            self.reactor.handlers.clear()\n\n    def window_new(self):\n        self.execute(\n            selenium.webdriver.remote.command.Command.NEW_WINDOW, {\"type\": \"window\"}\n        )\n\n    def tab_new(self, url: str):\n        \"\"\"\n        this opens a url in a new tab.\n        apparently, that passes all tests directly!\n\n        Parameters\n        ----------\n        url\n\n        Returns\n        -------\n\n        \"\"\"\n        if not hasattr(self, \"cdp\"):\n            from .cdp import CDP\n\n            cdp = CDP(self.options)\n            cdp.tab_new(url)\n\n    def reconnect(self, timeout=0.1):\n        try:\n            self.service.stop()\n        except Exception as e:\n            logger.debug(e)\n        time.sleep(timeout)\n        try:\n            self.service.start()\n        except Exception as e:\n            logger.debug(e)\n\n        try:\n            self.start_session()\n        except Exception as e:\n            logger.debug(e)\n\n    def start_session(self, capabilities=None, browser_profile=None):\n        if not capabilities:\n            capabilities = self.options.to_capabilities()\n        super().start_session(capabilities)\n        # super(Chrome, self).start_session(capabilities, browser_profile) # Original explicit call commented out\n\n    def find_elements_recursive(self, by, value):\n        \"\"\"\n        find elements in all frames\n        this is a generator function, which is needed\n            since if it would return a list of elements, they\n            will be stale on arrival.\n        using generator, when the element is returned we are in the correct frame\n        to use it directly\n        Args:\n            by: By\n            value: str\n        Returns: Generator[webelement.WebElement]\n        \"\"\"\n        def search_frame(f=None):\n            if not f:\n                # ensure we are on main content frame\n                self.switch_to.default_content()\n            else:\n                self.switch_to.frame(f)\n            for elem in self.find_elements(by, value):\n                yield elem\n            # switch back to main content, otherwise we will get StaleElementReferenceException\n            self.switch_to.default_content()\n\n        # search root frame\n        for elem in search_frame():\n            yield elem\n        # get iframes\n        frames = self.find_elements('css selector', 'iframe')\n\n        # search per frame\n        for f in frames:\n            for elem in search_frame(f):\n                yield elem\n\n    def quit(self):\n        try:\n            self.service.process.kill()\n            logger.debug(\"webdriver process ended\")\n        except (AttributeError, RuntimeError, OSError):\n            pass\n        try:\n            self.reactor.event.set()\n            logger.debug(\"shutting down reactor\")\n        except AttributeError:\n            pass\n        try:\n            os.kill(self.browser_pid, 15)\n            logger.debug(\"gracefully closed browser\")\n        except Exception as e:  # noqa\n            pass\n        if (\n            hasattr(self, \"keep_user_data_dir\")\n            and hasattr(self, \"user_data_dir\")\n            and not self.keep_user_data_dir\n        ):\n            for _ in range(5):\n                try:\n                    shutil.rmtree(self.user_data_dir, ignore_errors=False)\n                except FileNotFoundError:\n                    pass\n                except (RuntimeError, OSError, PermissionError) as e:\n                    logger.debug(\n                        \"When removing the temp profile, a %s occured: %s\\nretrying...\"\n                        % (e.__class__.__name__, e)\n                    )\n                else:\n                    logger.debug(\"successfully removed %s\" % self.user_data_dir)\n                    break\n                time.sleep(0.1)\n\n        # dereference patcher, so patcher can start cleaning up as well.\n        # this must come last, otherwise it will throw 'in use' errors\n        self.patcher = None\n\n    def __getattribute__(self, item):\n        if not super().__getattribute__(\"debug\"):\n            return super().__getattribute__(item)\n        else:\n            import inspect\n\n            original = super().__getattribute__(item)\n            if inspect.ismethod(original) and not inspect.isclass(original):\n\n                def newfunc(*args, **kwargs):\n                    logger.debug(\n                        \"calling %s with args %s and kwargs %s\\n\"\n                        % (original.__qualname__, args, kwargs)\n                    )\n                    return original(*args, **kwargs)\n\n                return newfunc\n            return original\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, exc_type, exc_val, exc_tb):\n        self.service.stop()\n        time.sleep(self._delay)\n        self.service.start()\n        self.start_session()\n\n    def __hash__(self):\n        return hash(self.options.debugger_address)\n\n    def __dir__(self):\n        return object.__dir__(self)\n\n    def __del__(self):\n        try:\n            self.service.process.kill()\n        except:  # noqa\n            pass\n        self.quit()\n\n    @classmethod\n    def _ensure_close(cls, self):\n        # needs to be a classmethod so finalize can find the reference\n        logger.info(\"ensuring close\")\n        if (\n            hasattr(self, \"service\")\n            and hasattr(self.service, \"process\")\n            and hasattr(self.service.process, \"kill\")\n        ):\n            self.service.process.kill()\n\n\ndef find_chrome_executable():\n    \"\"\"\n    Finds the chrome, chrome beta, chrome canary, chromium executable\n\n    Returns\n    -------\n    executable_path :  str\n        the full file path to found executable\n\n    \"\"\"\n    candidates = set()\n    if IS_POSIX:\n        for item in os.environ.get(\"PATH\").split(os.pathsep):\n            for subitem in (\n                \"google-chrome\",\n                \"chromium\",\n                \"chromium-browser\",\n                \"chrome\",\n                \"google-chrome-stable\",\n            ):\n                candidates.add(os.sep.join((item, subitem)))\n        if \"darwin\" in sys.platform:\n            candidates.update(\n                [\n                    \"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\",\n                    \"/Applications/Chromium.app/Contents/MacOS/Chromium\",\n                ]\n            )\n    else:\n        for item in map(\n            os.environ.get,\n            (\"PROGRAMFILES\", \"PROGRAMFILES(X86)\", \"LOCALAPPDATA\", \"PROGRAMW6432\"),\n        ):\n            if item is not None:\n                for subitem in (\n                    \"Google/Chrome/Application\",\n                ):\n                    candidates.add(os.sep.join((item, subitem, \"chrome.exe\")))\n    for candidate in candidates:\n        logger.debug('checking if %s exists and is executable' % candidate)\n        if os.path.exists(candidate) and os.access(candidate, os.X_OK):\n            logger.debug('found! using %s' % candidate)\n            return os.path.normpath(candidate)\n"
  },
  {
    "path": "undetected_chromedriver/cdp.py",
    "content": "#!/usr/bin/env python3\n# this module is part of undetected_chromedriver\n\nimport json\nimport logging\n\nimport requests\nimport websockets\n\n\nlog = logging.getLogger(__name__)\n\n\nclass CDPObject(dict):\n    def __init__(self, *a, **k):\n        super().__init__(*a, **k)\n        self.__dict__ = self\n        for k in self.__dict__:\n            if isinstance(self.__dict__[k], dict):\n                self.__dict__[k] = CDPObject(self.__dict__[k])\n            elif isinstance(self.__dict__[k], list):\n                for i in range(len(self.__dict__[k])):\n                    if isinstance(self.__dict__[k][i], dict):\n                        self.__dict__[k][i] = CDPObject(self)\n\n    def __repr__(self):\n        tpl = f\"{self.__class__.__name__}(\\n\\t{{}}\\n\\t)\"\n        return tpl.format(\"\\n  \".join(f\"{k} = {v}\" for k, v in self.items()))\n\n\nclass PageElement(CDPObject):\n    pass\n\n\nclass CDP:\n    log = logging.getLogger(\"CDP\")\n\n    endpoints = CDPObject(\n        {\n            \"json\": \"/json\",\n            \"protocol\": \"/json/protocol\",\n            \"list\": \"/json/list\",\n            \"new\": \"/json/new?{url}\",\n            \"activate\": \"/json/activate/{id}\",\n            \"close\": \"/json/close/{id}\",\n        }\n    )\n\n    def __init__(self, options: \"ChromeOptions\"):  # noqa\n        self.server_addr = \"http://{0}:{1}\".format(*options.debugger_address.split(\":\"))\n\n        self._reqid = 0\n        self._session = requests.Session()\n        self._last_resp = None\n        self._last_json = None\n\n        resp = self.get(self.endpoints.json)  # noqa\n        self.sessionId = resp[0][\"id\"]\n        self.wsurl = resp[0][\"webSocketDebuggerUrl\"]\n\n    def tab_activate(self, id=None):\n        if not id:\n            active_tab = self.tab_list()[0]\n            id = active_tab.id  # noqa\n            self.wsurl = active_tab.webSocketDebuggerUrl  # noqa\n        return self.post(self.endpoints[\"activate\"].format(id=id))\n\n    def tab_list(self):\n        retval = self.get(self.endpoints[\"list\"])\n        return [PageElement(o) for o in retval]\n\n    def tab_new(self, url):\n        return self.post(self.endpoints[\"new\"].format(url=url))\n\n    def tab_close_last_opened(self):\n        sessions = self.tab_list()\n        opentabs = [s for s in sessions if s[\"type\"] == \"page\"]\n        return self.post(self.endpoints[\"close\"].format(id=opentabs[-1][\"id\"]))\n\n    async def send(self, method: str, params: dict):\n        self._reqid += 1\n        async with websockets.connect(self.wsurl) as ws:\n            await ws.send(\n                json.dumps({\"method\": method, \"params\": params, \"id\": self._reqid})\n            )\n            self._last_resp = await ws.recv()\n            self._last_json = json.loads(self._last_resp)\n            self.log.info(self._last_json)\n\n    def get(self, uri):\n        resp = self._session.get(self.server_addr + uri)\n        try:\n            self._last_resp = resp\n            self._last_json = resp.json()\n        except Exception:\n            return\n        else:\n            return self._last_json\n\n    def post(self, uri, data: dict = None):\n        if not data:\n            data = {}\n        resp = self._session.post(self.server_addr + uri, json=data)\n        try:\n            self._last_resp = resp\n            self._last_json = resp.json()\n        except Exception:\n            return self._last_resp\n\n    @property\n    def last_json(self):\n        return self._last_json\n"
  },
  {
    "path": "undetected_chromedriver/devtool.py",
    "content": "import asyncio\nfrom collections.abc import Mapping\nfrom collections.abc import Sequence\nfrom functools import wraps\nimport logging\nimport threading\nimport time\nimport traceback\nfrom typing import Any\nfrom typing import Awaitable\nfrom typing import Callable\nfrom typing import List\nfrom typing import Optional\n\n\nclass Structure(dict):\n    \"\"\"\n    This is a dict-like object structure, which you should subclass\n    Only properties defined in the class context are used on initialization.\n\n    See example\n    \"\"\"\n\n    _store = {}\n\n    def __init__(self, *a, **kw):\n        \"\"\"\n        Instantiate a new instance.\n\n        :param a:\n        :param kw:\n        \"\"\"\n\n        super().__init__()\n\n        # auxiliar dict\n        d = dict(*a, **kw)\n        for k, v in d.items():\n            if isinstance(v, Mapping):\n                self[k] = self.__class__(v)\n            elif isinstance(v, Sequence) and not isinstance(v, (str, bytes)):\n                self[k] = [self.__class__(i) for i in v]\n            else:\n                self[k] = v\n        super().__setattr__(\"__dict__\", self)\n\n    def __getattr__(self, item):\n        return getattr(super(), item)\n\n    def __getitem__(self, item):\n        return super().__getitem__(item)\n\n    def __setattr__(self, key, value):\n        self.__setitem__(key, value)\n\n    def __setitem__(self, key, value):\n        super().__setitem__(key, value)\n\n    def update(self, *a, **kw):\n        super().update(*a, **kw)\n\n    def __eq__(self, other):\n        return frozenset(other.items()) == frozenset(self.items())\n\n    def __hash__(self):\n        return hash(frozenset(self.items()))\n\n    @classmethod\n    def __init_subclass__(cls, **kwargs):\n        cls._store = {}\n\n    def _normalize_strings(self):\n        for k, v in self.copy().items():\n            if isinstance(v, (str)):\n                self[k] = v.strip()\n\n\ndef timeout(seconds=3, on_timeout: Optional[Callable[[callable], Any]] = None):\n    def wrapper(func):\n        @wraps(func)\n        def wrapped(*args, **kwargs):\n            def function_reached_timeout():\n                if on_timeout:\n                    on_timeout(func)\n                else:\n                    raise TimeoutError(\"function call timed out\")\n\n            t = threading.Timer(interval=seconds, function=function_reached_timeout)\n            t.start()\n            try:\n                return func(*args, **kwargs)\n            except:\n                t.cancel()\n                raise\n            finally:\n                t.cancel()\n\n        return wrapped\n\n    return wrapper\n\n\ndef test():\n    import sys, os\n\n    sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))\n    import undetected_chromedriver as uc\n    import threading\n\n    def collector(\n        driver: uc.Chrome,\n        stop_event: threading.Event,\n        on_event_coro: Optional[Callable[[List[str]], Awaitable[Any]]] = None,\n        listen_events: Sequence = (\"browser\", \"network\", \"performance\"),\n    ):\n        def threaded(driver, stop_event, on_event_coro):\n            async def _ensure_service_started():\n                while (\n                    getattr(driver, \"service\", False)\n                    and getattr(driver.service, \"process\", False)\n                    and driver.service.process.poll()\n                ):\n                    print(\"waiting for driver service to come back on\")\n                    await asyncio.sleep(0.05)\n                    # await asyncio.sleep(driver._delay or .25)\n\n            async def get_log_lines(typ):\n                await _ensure_service_started()\n                return driver.get_log(typ)\n\n            async def looper():\n                while not stop_event.is_set():\n                    log_lines = []\n                    try:\n                        for _ in listen_events:\n                            try:\n                                log_lines += await get_log_lines(_)\n                            except:\n                                if logging.getLogger().getEffectiveLevel() <= 10:\n                                    traceback.print_exc()\n                                continue\n                        if log_lines and on_event_coro:\n                            await on_event_coro(log_lines)\n                    except Exception as e:\n                        if logging.getLogger().getEffectiveLevel() <= 10:\n                            traceback.print_exc()\n\n            loop = asyncio.new_event_loop()\n            asyncio.set_event_loop(loop)\n            loop.run_until_complete(looper())\n\n        t = threading.Thread(target=threaded, args=(driver, stop_event, on_event_coro))\n        t.start()\n\n    async def on_event(data):\n        print(\"on_event\")\n        print(\"data:\", data)\n\n    def func_called(fn):\n        def wrapped(*args, **kwargs):\n            print(\n                \"func called! %s  (args: %s, kwargs: %s)\" % (fn.__name__, args, kwargs)\n            )\n            while driver.service.process and driver.service.process.poll() is not None:\n                time.sleep(0.1)\n            res = fn(*args, **kwargs)\n            print(\"func completed! (result: %s)\" % res)\n            return res\n\n        return wrapped\n\n    logging.basicConfig(level=10)\n\n    options = uc.ChromeOptions()\n    options.set_capability(\n        \"goog:loggingPrefs\", {\"performance\": \"ALL\", \"browser\": \"ALL\", \"network\": \"ALL\"}\n    )\n\n    driver = uc.Chrome(version_main=96, options=options)\n\n    # driver.command_executor._request = timeout(seconds=1)(driver.command_executor._request)\n    driver.command_executor._request = func_called(driver.command_executor._request)\n    collector_stop = threading.Event()\n    collector(driver, collector_stop, on_event)\n\n    driver.get(\"https://nowsecure.nl\")\n\n    time.sleep(10)\n\n    driver.quit()\n"
  },
  {
    "path": "undetected_chromedriver/dprocess.py",
    "content": "import atexit\nimport logging\nimport multiprocessing\nimport os\nimport platform\nimport signal\nfrom subprocess import PIPE\nfrom subprocess import Popen\nimport sys\n\n\nCREATE_NEW_PROCESS_GROUP = 0x00000200\nDETACHED_PROCESS = 0x00000008\n\nREGISTERED = []\n\n\ndef start_detached(executable, *args):\n    \"\"\"\n    Starts a fully independent subprocess (with no parent)\n    :param executable: executable\n    :param args: arguments to the executable, eg: ['--param1_key=param1_val', '-vvv' ...]\n    :return: pid of the grandchild process\n    \"\"\"\n\n    # create pipe\n    reader, writer = multiprocessing.Pipe(False)\n\n    # do not keep reference\n    multiprocessing.Process(\n        target=_start_detached,\n        args=(executable, *args),\n        kwargs={\"writer\": writer},\n        daemon=True,\n    ).start()\n    # receive pid from pipe\n    pid = reader.recv()\n    REGISTERED.append(pid)\n    # close pipes\n    writer.close()\n    reader.close()\n\n    return pid\n\n\ndef _start_detached(executable, *args, writer: multiprocessing.Pipe = None):\n    # configure launch\n    kwargs = {}\n    if platform.system() == \"Windows\":\n        kwargs.update(creationflags=DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)\n    elif sys.version_info < (3, 2):\n        # assume posix\n        kwargs.update(preexec_fn=os.setsid)\n    else:  # Python 3.2+ and Unix\n        kwargs.update(start_new_session=True)\n\n    # run\n    p = Popen([executable, *args], stdin=PIPE, stdout=PIPE, stderr=PIPE, **kwargs)\n\n    # send pid to pipe\n    writer.send(p.pid)\n    sys.exit()\n\n\ndef _cleanup():\n    for pid in REGISTERED:\n        try:\n            logging.getLogger(__name__).debug(\"cleaning up pid %d \" % pid)\n            os.kill(pid, signal.SIGTERM)\n        except:  # noqa\n            pass\n\n\natexit.register(_cleanup)\n"
  },
  {
    "path": "undetected_chromedriver/options.py",
    "content": "#!/usr/bin/env python3\n# this module is part of undetected_chromedriver\n\n\nimport json\nimport os\n\nfrom selenium.webdriver.chromium.options import ChromiumOptions as _ChromiumOptions\n\n\nclass ChromeOptions(_ChromiumOptions):\n    _session = None\n    _user_data_dir = None\n\n    @property\n    def user_data_dir(self):\n        return self._user_data_dir\n\n    @user_data_dir.setter\n    def user_data_dir(self, path: str):\n        \"\"\"\n        Sets the browser profile folder to use, or creates a new profile\n        at given <path>.\n\n        Parameters\n        ----------\n        path: str\n            the path to a chrome profile folder\n            if it does not exist, a new profile will be created at given location\n        \"\"\"\n        apath = os.path.abspath(path)\n        self._user_data_dir = os.path.normpath(apath)\n\n    @staticmethod\n    def _undot_key(key, value):\n        \"\"\"turn a (dotted key, value) into a proper nested dict\"\"\"\n        if \".\" in key:\n            key, rest = key.split(\".\", 1)\n            value = ChromeOptions._undot_key(rest, value)\n        return {key: value}\n\n    @staticmethod\n    def _merge_nested(a, b):\n        \"\"\"\n        merges b into a\n        leaf values in a are overwritten with values from b\n        \"\"\"\n        for key in b:\n            if key in a:\n                if isinstance(a[key], dict) and isinstance(b[key], dict):\n                    ChromeOptions._merge_nested(a[key], b[key])\n                    continue\n            a[key] = b[key]\n        return a\n\n    def handle_prefs(self, user_data_dir):\n        prefs = self.experimental_options.get(\"prefs\")\n        if prefs:\n            user_data_dir = user_data_dir or self._user_data_dir\n            default_path = os.path.join(user_data_dir, \"Default\")\n            os.makedirs(default_path, exist_ok=True)\n\n            # undot prefs dict keys\n            undot_prefs = {}\n            for key, value in prefs.items():\n                undot_prefs = self._merge_nested(\n                    undot_prefs, self._undot_key(key, value)\n                )\n\n            prefs_file = os.path.join(default_path, \"Preferences\")\n            if os.path.exists(prefs_file):\n                with open(prefs_file, encoding=\"latin1\", mode=\"r\") as f:\n                    undot_prefs = self._merge_nested(json.load(f), undot_prefs)\n\n            with open(prefs_file, encoding=\"latin1\", mode=\"w\") as f:\n                json.dump(undot_prefs, f)\n\n            # remove the experimental_options to avoid an error\n            del self._experimental_options[\"prefs\"]\n\n    @classmethod\n    def from_options(cls, options):\n        o = cls()\n        o.__dict__.update(options.__dict__)\n        return o\n"
  },
  {
    "path": "undetected_chromedriver/patcher.py",
    "content": "#!/usr/bin/env python3\n# this module is part of undetected_chromedriver\n\nfrom packaging.version import Version as LooseVersion\nimport io\nimport json\nimport logging\nimport os\nimport pathlib\nimport platform\nimport random\nimport re\nimport shutil\nimport string\nimport subprocess\nimport sys\nimport time\nfrom urllib.request import urlopen\nfrom urllib.request import urlretrieve\nimport zipfile\nfrom multiprocessing import Lock\n\nlogger = logging.getLogger(__name__)\n\nIS_POSIX = sys.platform.startswith((\"darwin\", \"cygwin\", \"linux\", \"linux2\"))\n\n\nclass Patcher(object):\n    lock = Lock()\n    exe_name = \"chromedriver%s\"\n\n    platform = sys.platform\n    if platform.endswith(\"win32\"):\n        d = \"~/appdata/roaming/undetected_chromedriver\"\n    elif \"LAMBDA_TASK_ROOT\" in os.environ:\n        d = \"/tmp/undetected_chromedriver\"\n    elif platform.startswith((\"linux\", \"linux2\")):\n        d = \"~/.local/share/undetected_chromedriver\"\n    elif platform.endswith(\"darwin\"):\n        d = \"~/Library/Application Support/undetected_chromedriver\"\n    else:\n        d = \"~/.undetected_chromedriver\"\n    data_path = os.path.abspath(os.path.expanduser(d))\n\n    def __init__(\n        self,\n        executable_path=None,\n        force=False,\n        version_main: int = 0,\n        user_multi_procs=False,\n    ):\n        \"\"\"\n        Args:\n            executable_path: None = automatic\n                             a full file path to the chromedriver executable\n            force: False\n                    terminate processes which are holding lock\n            version_main: 0 = auto\n                specify main chrome version (rounded, ex: 82)\n        \"\"\"\n        self.force = force\n        self._custom_exe_path = False\n        prefix = \"undetected\"\n        self.user_multi_procs = user_multi_procs\n\n        self.is_old_chromedriver = version_main and version_main <= 114\n        # Needs to be called before self.exe_name is accessed\n        self._set_platform_name()\n\n        if not os.path.exists(self.data_path):\n            os.makedirs(self.data_path, exist_ok=True)\n\n        if not executable_path:\n            self.executable_path = os.path.join(\n                self.data_path, \"_\".join([prefix, self.exe_name])\n            )\n\n        if not IS_POSIX:\n            if executable_path:\n                if not executable_path[-4:] == \".exe\":\n                    executable_path += \".exe\"\n\n        self.zip_path = os.path.join(self.data_path, prefix)\n\n        if not executable_path:\n            if not self.user_multi_procs:\n                self.executable_path = os.path.abspath(\n                    os.path.join(\".\", self.executable_path)\n                )\n\n        if executable_path:\n            self._custom_exe_path = True\n            self.executable_path = executable_path\n\n        # Set the correct repository to download the Chromedriver from\n        if self.is_old_chromedriver:\n            self.url_repo = \"https://chromedriver.storage.googleapis.com\"\n        else:\n            self.url_repo = \"https://googlechromelabs.github.io/chrome-for-testing\"\n\n        self.version_main = version_main\n        self.version_full = None\n\n    def _set_platform_name(self):\n        \"\"\"\n        Set the platform and exe name based on the platform undetected_chromedriver is running on\n        in order to download the correct chromedriver.\n        \"\"\"\n        if self.platform.endswith(\"win32\"):\n            self.platform_name = \"win32\"\n            self.exe_name %= \".exe\"\n        if self.platform.endswith((\"linux\", \"linux2\")):\n            self.platform_name = \"linux64\"\n            self.exe_name %= \"\"\n        if self.platform.endswith(\"darwin\"):\n            if self.is_old_chromedriver:\n                self.platform_name = \"mac64\"\n            else:\n                self.platform_name = \"mac-x64\"\n            self.exe_name %= \"\"\n\n    def auto(self, executable_path=None, force=False, version_main=None, _=None):\n        \"\"\"\n\n        Args:\n            executable_path:\n            force:\n            version_main:\n\n        Returns:\n\n        \"\"\"\n        p = pathlib.Path(self.data_path)\n        if self.user_multi_procs:\n            with Lock():\n                files = list(p.rglob(\"*chromedriver*\"))\n                most_recent = max(files, key=lambda f: f.stat().st_mtime)\n                files.remove(most_recent)\n                list(map(lambda f: f.unlink(), files))\n                if self.is_binary_patched(most_recent):\n                    self.executable_path = str(most_recent)\n                    return True\n\n        if executable_path:\n            self.executable_path = executable_path\n            self._custom_exe_path = True\n\n        if self._custom_exe_path:\n            ispatched = self.is_binary_patched(self.executable_path)\n            if not ispatched:\n                return self.patch_exe()\n            else:\n                return\n\n        if version_main:\n            self.version_main = version_main\n        if force is True:\n            self.force = force\n\n        try:\n            os.unlink(self.executable_path)\n        except PermissionError:\n            if self.force:\n                self.force_kill_instances(self.executable_path)\n                return self.auto(force=not self.force)\n            try:\n                if self.is_binary_patched():\n                    # assumes already running AND patched\n                    return True\n            except PermissionError:\n                pass\n            # return False\n        except FileNotFoundError:\n            pass\n\n        release = self.fetch_release_number()\n        self.version_main = release.version[0]\n        self.version_full = release\n        self.unzip_package(self.fetch_package())\n        return self.patch()\n\n    def driver_binary_in_use(self, path: str = None) -> bool:\n        \"\"\"\n        naive test to check if a found chromedriver binary is\n        currently in use\n\n        Args:\n            path: a string or PathLike object to the binary to check.\n                  if not specified, we check use this object's executable_path\n        \"\"\"\n        if not path:\n            path = self.executable_path\n        p = pathlib.Path(path)\n\n        if not p.exists():\n            raise OSError(\"file does not exist: %s\" % p)\n        try:\n            with open(p, mode=\"a+b\") as fs:\n                exc = []\n                try:\n\n                    fs.seek(0, 0)\n                except PermissionError as e:\n                    exc.append(e)  # since some systems apprently allow seeking\n                    # we conduct another test\n                try:\n                    fs.readline()\n                except PermissionError as e:\n                    exc.append(e)\n\n                if exc:\n\n                    return True\n                return False\n            # ok safe to assume this is in use\n        except Exception as e:\n            # logger.exception(\"whoops \", e)\n            pass\n\n    def cleanup_unused_files(self):\n        p = pathlib.Path(self.data_path)\n        items = list(p.glob(\"*undetected*\"))\n        for item in items:\n            try:\n                item.unlink()\n            except:\n                pass\n\n    def patch(self):\n        self.patch_exe()\n        return self.is_binary_patched()\n\n    def fetch_release_number(self):\n        \"\"\"\n        Gets the latest major version available, or the latest major version of self.target_version if set explicitly.\n        :return: version string\n        :rtype: LooseVersion\n        \"\"\"\n        # Endpoint for old versions of Chromedriver (114 and below)\n        if self.is_old_chromedriver:\n            path = f\"/latest_release_{self.version_main}\"\n            path = path.upper()\n            logger.debug(\"getting release number from %s\" % path)\n            return LooseVersion(urlopen(self.url_repo + path).read().decode())\n\n        # Endpoint for new versions of Chromedriver (115+)\n        if not self.version_main:\n            # Fetch the latest version\n            path = \"/last-known-good-versions-with-downloads.json\"\n            logger.debug(\"getting release number from %s\" % path)\n            with urlopen(self.url_repo + path) as conn:\n                response = conn.read().decode()\n\n            last_versions = json.loads(response)\n            return LooseVersion(last_versions[\"channels\"][\"Stable\"][\"version\"])\n\n        # Fetch the latest minor version of the major version provided\n        path = \"/latest-versions-per-milestone-with-downloads.json\"\n        logger.debug(\"getting release number from %s\" % path)\n        with urlopen(self.url_repo + path) as conn:\n            response = conn.read().decode()\n\n        major_versions = json.loads(response)\n        return LooseVersion(major_versions[\"milestones\"][str(self.version_main)][\"version\"])\n\n    def parse_exe_version(self):\n        with io.open(self.executable_path, \"rb\") as f:\n            for line in iter(lambda: f.readline(), b\"\"):\n                match = re.search(rb\"platform_handle\\x00content\\x00([0-9.]*)\", line)\n                if match:\n                    return LooseVersion(match[1].decode())\n\n    def fetch_package(self):\n        \"\"\"\n        Downloads ChromeDriver from source\n\n        :return: path to downloaded file\n        \"\"\"\n        zip_name = f\"chromedriver_{self.platform_name}.zip\"\n        if self.is_old_chromedriver:\n            download_url = \"%s/%s/%s\" % (self.url_repo, self.version_full.vstring, zip_name)\n        else:\n            zip_name = zip_name.replace(\"_\", \"-\", 1)\n            download_url = \"https://storage.googleapis.com/chrome-for-testing-public/%s/%s/%s\"\n            download_url %= (self.version_full.vstring, self.platform_name, zip_name)\n\n        logger.debug(\"downloading from %s\" % download_url)\n        return urlretrieve(download_url)[0]\n\n    def unzip_package(self, fp):\n        \"\"\"\n        Does what it says\n\n        :return: path to unpacked executable\n        \"\"\"\n        exe_path = self.exe_name\n        if not self.is_old_chromedriver:\n            # The new chromedriver unzips into its own folder\n            zip_name = f\"chromedriver-{self.platform_name}\"\n            exe_path = os.path.join(zip_name, self.exe_name)\n\n        logger.debug(\"unzipping %s\" % fp)\n        try:\n            os.unlink(self.zip_path)\n        except (FileNotFoundError, OSError):\n            pass\n\n        os.makedirs(self.zip_path, mode=0o755, exist_ok=True)\n        with zipfile.ZipFile(fp, mode=\"r\") as zf:\n            zf.extractall(self.zip_path)\n        os.rename(os.path.join(self.zip_path, exe_path), self.executable_path)\n        os.remove(fp)\n        shutil.rmtree(self.zip_path)\n        os.chmod(self.executable_path, 0o755)\n        return self.executable_path\n\n    @staticmethod\n    def force_kill_instances(exe_name):\n        \"\"\"\n        kills running instances.\n        :param: executable name to kill, may be a path as well\n\n        :return: True on success else False\n        \"\"\"\n        exe_name = os.path.basename(exe_name)\n        if IS_POSIX:\n            # Using shell=True for pidof, consider a more robust pid finding method if issues arise.\n            # pgrep can be an alternative: [\"pgrep\", \"-f\", exe_name]\n            # Or psutil if adding a dependency is acceptable.\n            command = f\"pidof {exe_name}\"\n            try:\n                result = subprocess.run(command, shell=True, capture_output=True, text=True, check=True)\n                pids = result.stdout.strip().split()\n                if pids:\n                    subprocess.run([\"kill\", \"-9\"] + pids, check=False) # Changed from -f -9 to -9 as -f is not standard for kill\n                    return True\n                return False # No PIDs found\n            except subprocess.CalledProcessError: # pidof returns 1 if no process found\n                return False # No process found\n            except Exception as e:\n                logger.debug(f\"Error killing process on POSIX: {e}\")\n                return False\n        else:\n            try:\n                # TASKKILL /F /IM chromedriver.exe\n                result = subprocess.run([\"taskkill\", \"/f\", \"/im\", exe_name], check=False, capture_output=True)\n                # taskkill returns 0 if process was killed, 128 if not found.\n                return result.returncode == 0\n            except Exception as e:\n                logger.debug(f\"Error killing process on Windows: {e}\")\n                return False\n\n    @staticmethod\n    def gen_random_cdc():\n        cdc = random.choices(string.ascii_letters, k=27)\n        return \"\".join(cdc).encode()\n\n    def is_binary_patched(self, executable_path=None):\n        executable_path = executable_path or self.executable_path\n        try:\n            with io.open(executable_path, \"rb\") as fh:\n                return fh.read().find(b\"undetected chromedriver\") != -1\n        except FileNotFoundError:\n            return False\n\n    def patch_exe(self):\n        start = time.perf_counter()\n        logger.info(\"patching driver executable %s\" % self.executable_path)\n        with io.open(self.executable_path, \"r+b\") as fh:\n            content = fh.read()\n            # match_injected_codeblock = re.search(rb\"{window.*;}\", content)\n            match_injected_codeblock = re.search(rb\"\\{window\\.cdc.*?;\\}\", content)\n            if match_injected_codeblock:\n                target_bytes = match_injected_codeblock[0]\n                new_target_bytes = (\n                    b'{console.log(\"undetected chromedriver 1337!\")}'.ljust(\n                        len(target_bytes), b\" \"\n                    )\n                )\n                new_content = content.replace(target_bytes, new_target_bytes)\n                if new_content == content:\n                    logger.warning(\n                        \"something went wrong patching the driver binary. could not find injection code block\"\n                    )\n                else:\n                    logger.debug(\n                        \"found block:\\n%s\\nreplacing with:\\n%s\"\n                        % (target_bytes, new_target_bytes)\n                    )\n                fh.seek(0)\n                fh.write(new_content)\n        logger.debug(\n            \"patching took us {:.2f} seconds\".format(time.perf_counter() - start)\n        )\n\n    def __repr__(self):\n        return \"{0:s}({1:s})\".format(\n            self.__class__.__name__,\n            self.executable_path,\n        )\n\n    def __del__(self):\n        if self._custom_exe_path:\n            # if the driver binary is specified by user\n            # we assume it is important enough to not delete it\n            return\n        else:\n            timeout = 3  # stop trying after this many seconds\n            t = time.monotonic()\n            now = lambda: time.monotonic()\n            while now() - t > timeout:\n                # we don't want to wait until the end of time\n                try:\n                    if self.user_multi_procs:\n                        break\n                    os.unlink(self.executable_path)\n                    logger.debug(\"successfully unlinked %s\" % self.executable_path)\n                    break\n                except (OSError, RuntimeError, PermissionError):\n                    time.sleep(0.01)\n                    continue\n                except FileNotFoundError:\n                    break\n"
  },
  {
    "path": "undetected_chromedriver/reactor.py",
    "content": "#!/usr/bin/env python3\n# this module is part of undetected_chromedriver\n\nimport asyncio\nimport json\nimport logging\nimport threading\n\n\nlogger = logging.getLogger(__name__)\n\n\nclass Reactor(threading.Thread):\n    def __init__(self, driver: \"Chrome\"):\n        super().__init__()\n\n        self.driver = driver\n        self.loop = asyncio.new_event_loop()\n\n        self.lock = threading.Lock()\n        self.event = threading.Event()\n        self.daemon = True\n        self.handlers = {}\n\n    def add_event_handler(self, method_name, callback: callable):\n        \"\"\"\n\n        Parameters\n        ----------\n        event_name: str\n            example \"Network.responseReceived\"\n\n        callback: callable\n            callable which accepts 1 parameter: the message object dictionary\n\n        Returns\n        -------\n\n        \"\"\"\n        with self.lock:\n            self.handlers[method_name.lower()] = callback\n\n    @property\n    def running(self):\n        return not self.event.is_set()\n\n    def run(self):\n        try:\n            asyncio.set_event_loop(self.loop)\n            self.loop.run_until_complete(self.listen())\n        except Exception as e:\n            logger.warning(\"Reactor.run() => %s\", e)\n\n    async def _wait_service_started(self):\n        while True:\n            with self.lock:\n                if (\n                    getattr(self.driver, \"service\", None)\n                    and getattr(self.driver.service, \"process\", None)\n                    and self.driver.service.process.poll()\n                ):\n                    await asyncio.sleep(self.driver._delay or 0.25)\n                else:\n                    break\n\n    async def listen(self):\n        while self.running:\n            await self._wait_service_started()\n            await asyncio.sleep(1)\n\n            try:\n                with self.lock:\n                    log_entries = self.driver.get_log(\"performance\")\n\n                for entry in log_entries:\n                    try:\n                        obj_serialized: str = entry.get(\"message\")\n                        obj = json.loads(obj_serialized)\n                        message = obj.get(\"message\")\n                        method = message.get(\"method\")\n\n                        if \"*\" in self.handlers:\n                            await self.loop.run_in_executor(\n                                None, self.handlers[\"*\"], message\n                            )\n                        elif method.lower() in self.handlers:\n                            await self.loop.run_in_executor(\n                                None, self.handlers[method.lower()], message\n                            )\n\n                        # print(type(message), message)\n                    except Exception as e:\n                        raise e from None\n\n            except Exception as e:\n                if \"invalid session id\" in str(e):\n                    pass\n                else:\n                    logging.debug(\"exception ignored :\", e)\n"
  },
  {
    "path": "undetected_chromedriver/webelement.py",
    "content": "from typing import List\n\nfrom selenium.webdriver.common.by import By\nimport selenium.webdriver.remote.webelement\n\n\nclass WebElement(selenium.webdriver.remote.webelement.WebElement):\n    def click_safe(self):\n        super().click()\n        self._parent.reconnect(0.1)\n\n    def children(\n        self, tag=None, recursive=False\n    ) -> List[selenium.webdriver.remote.webelement.WebElement]:\n        \"\"\"\n        returns direct child elements of current element\n        :param tag: str,  if supplied, returns <tag> nodes only\n        \"\"\"\n        script = \"return [... arguments[0].children]\"\n        if tag:\n            script += \".filter( node => node.tagName === '%s')\" % tag.upper()\n        if recursive:\n            return list(_recursive_children(self, tag))\n        return list(self._parent.execute_script(script, self))\n\n\nclass UCWebElement(WebElement):\n    \"\"\"\n    Custom WebElement class which makes it easier to view elements when\n    working in an interactive environment.\n\n    standard webelement repr:\n    <selenium.webdriver.remote.webelement.WebElement (session=\"85ff0f671512fa535630e71ee951b1f2\", element=\"6357cb55-92c3-4c0f-9416-b174f9c1b8c4\")>\n\n    using this WebElement class:\n    <WebElement(<a class=\"mobile-show-inline-block mc-update-infos init-ok\" href=\"#\" id=\"main-cat-switcher-mobile\">)>\n\n    \"\"\"\n\n    def __init__(self, parent, id_):\n        super().__init__(parent, id_)\n        self._attrs = None\n\n    @property\n    def attrs(self):\n        if not self._attrs:\n            self._attrs = self._parent.execute_script(\n                \"\"\"\n                var items = {}; \n                for (index = 0; index < arguments[0].attributes.length; ++index) \n                {\n                 items[arguments[0].attributes[index].name] = arguments[0].attributes[index].value \n                }; \n                return items;\n                \"\"\",\n                self,\n            )\n        return self._attrs\n\n    def __repr__(self):\n        strattrs = \" \".join([f'{k}=\"{v}\"' for k, v in self.attrs.items()])\n        if strattrs:\n            strattrs = \" \" + strattrs\n        return f\"{self.__class__.__name__} <{self.tag_name}{strattrs}>\"\n\n\ndef _recursive_children(element, tag: str = None, _results=None):\n    \"\"\"\n    returns all children of <element> recursively\n\n    :param element: `WebElement` object.\n            find children below this <element>\n\n    :param tag: str = None.\n            if provided, return only <tag> elements. example: 'a', or 'img'\n    :param _results: do not use!\n    \"\"\"\n    results = _results or set()\n    for element in element.children():\n        if tag:\n            if element.tag_name == tag:\n                results.add(element)\n        else:\n            results.add(element)\n        results |= _recursive_children(element, tag, results)\n    return results\n"
  }
]