{ "info": { "author": "Keita Oouchi", "author_email": "keita.oouchi@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "About this module\n-----------------\nselenium webdriver wrapper to make manipulation easier.\n\n.. image:: https://secure.travis-ci.org/keitaoouchi/seleniumwrapper.png\n.. image:: https://pypip.in/download/seleniumwrapper/badge.svg?period=month\n :target: https://pypi.python.org/pypi//seleniumwrapper/\n :alt: Downloads\n.. image:: https://pypip.in/version/seleniumwrapper/badge.svg?text=version\n :target: https://pypi.python.org/pypi/seleniumwrapper/\n :alt: Latest Version\n.. image:: https://pypip.in/py_versions/seleniumwrapper/badge.svg\n :target: https://pypi.python.org/pypi/seleniumwrapper/\n :alt: Supported Python versions\n.. image:: https://pypip.in/status/seleniumwrapper/badge.svg\n :target: https://pypi.python.org/pypi/seleniumwrapper/\n :alt: Development Status\n\nFeatures\n--------\n\n* Support Internet Explorer, Chrome, Opera, Firefox, PhantomJS\n* Support remote webdriver.\n* Easy to type aliases. (find_element_by_xpath => xpath, etc.)\n* Wrapped WebdriverWait( ... ).until( ... ) pattern.\n* Polling at the time of clicking or selecting.\n* Wrapping chaining.\n\nHow to install\n--------------\nRequires python2.6 or later.\nYou need *pip* or *distribute* or *setuptools*::\n\n $ pip install seleniumwrapper\n\nor use easy_install::\n\n $ easy_install seleniumwrapper\n\nalso you need selenium::\n\n $ pip install selenium\n\nExample to use\n--------------\n\n**create** function helps you to init webdriver and wrap it easily::\n\n >>> import seleniumwrapper as selwrap\n >>> br = selwrap.create(\"chrome\")\n\n**connect** function helps you to use remote webdriver and wrap it::\n\n >>> br = connect(\"android\", \"http://localhost:9999\", {\"acceptSslCerts\": True})\n\nSeleniumWrapper delegate to its wrapped webdriver::\n\n >>> br.get(\"http://www.example.com\")\n \n >>> br.xpath(\"//div[@class='main'])\n \n\nSetting **eager=True** to invoke find_elements::\n\n >>> br.xpath(\"//a\", eager=True)\n \n\nSeleniumContainerWrapper also delegate to its wrapped container::\n\n >>> links = [i.get_attribute(\"href\") for i in br.xpath(\"//a\", eager=True)]\n\nEach contents in SeleniumContainerWrapper also SeleniumWrapper::\n\n >>> tds = [tr.xpath(\"//td\", eager=True) for tr in br.xpath(\"//tr\", eager=True)]\n\nBasic API\n---------\n* seleniumwrapper.create(drivername)\n* seleniumwrapper.connect(drivername, executor, custom_capabilities)\n Create webdriver instance and wrap it with SeleniumWrapper.\n\nSeleniumWrapper\n^^^^^^^^^^^^^^^\n* unwrap\n Retrieves WebDriver or WebElement from wrapped object::\n\n >>> isinstance(br.unwrap, WebElement)\n True\n\n* parent\n find_element_by_xpath(\"./parent::node()\")::\n\n >>> price = br.by_tag(\"th\", \"Price\").parent.by_tag(\"td\").text\n\n* performance\n Returns window.performance wrapped object::\n\n >>> performance = br.performance\n >>> timing = performance.timing\n >>> navigation = performance.navigation\n >>> timing.loadEventEnd\n 1358319427476\n\n* to_select\n Convert wrapped WebElement to raw Select object::\n\n >>> br.by_id('select_button').to_select.select_by_visible_text(\"hoge\")\n\n select method returns the same as below::\n\n >>> br.select(id = 'select_button').select_by_visible_text(\"hoge\")\n\n* alert\n Returns Alert(switch_to_alert()) object::\n\n >>> br.alert.accept()\n\n* current_url\n Returns current_url after loading page body::\n\n >>> br.current_url\n\n* timeout\n Accessor for _timeout property::\n\n >>> br.timeout\n 5\n >>> br.timeout = 10\n >>> br.timeout\n 10\n\n* silent\n Accessor for _silent property::\n\n # default\n >>> br.by_id(\"Hoge\")\n Traceback (most recent call last):\n ...\n NoSuchElementException:...\n >>> br.silent = True\n >>> br.by_id(\"Hoge\") is None\n True\n\n* attr(name)\n Shortcut to get_attribute::\n\n >>> br.attr('href')\n\n* click(timeout=3, presleep=0, postsleep=0)\n Continue to polling until timeout or element is displayed and clickable::\n\n >>> br.button(\"Send\").click()\n\n* scroll_to(x, y)\n equivalent to javascript's scrollTo::\n\n >>> br.scrollTo(0, 100)\n\n* scroll_by(x, y)\n equivalent to javascript's scrollBy::\n\n >>> br.scrollBy(10, 10)\n\n* scroll_into_view(jq_identifier, align_with_top=True)\n find elements by jq_identifier and retrieve its first element and invoke scrollIntoView to it::\n\n >>> var element = $('#hoge');\n >>> element && element.scrollIntoView(true)\n\n second argument is passed as javascript's boolean to scrollIntoView::\n\n >>> br.scrollIntoView('#hoge', False)\n\n* waitfor(type, target, eager=False, timeout=3)\n See source::\n\n >>> br.waitfor(\"xpath\", \"//input[@type='submit']\")\n\n* xpath(target, eager=False, timeout=3)\n find_element_by_xpath(target, timeout)::\n\n >>> buttons = br.xpath(\"//input[@type='submit' or @type='button']\", eager=True)\n\n* css(target, eager=False, timeout=3)\n find_element_by_css_selector(target, timeout)::\n\n >>> [li.text for li in br.css(\"ul li\")]\n\n* by_tag(self, tag, eager=False, timeout=3, \\*\\*attributes)\n Returns specified tagged element with specified attributes optionally.::\n\n >>> br.by_tag(\"link\", rel=\"stylesheet\")\n\n* by_text(text, tag='*', partial=False, eager=False, timeout=3)\n similar to find_element_by_link_text or find_element_by_partial_link_text, but this method can be applicable to any tag::\n\n >>> br.by_text(\"Go back to Top Page\", \"a\")\n\n* by_class(target, eager=False, timeout=3)\n find_element_by_class_name(target, timeout)::\n\n >>> br.by_class(\"colored\")\n\n* by_id(target, eager=False, timeout=3)\n find_element_by_id(target, timeout)::\n\n >>> br.by_id(\"main_contents\")\n\n* by_name(target, eager=False, timeout=3)\n find_element_by_name(target, timeout)::\n\n >>> br.by_name(\"page_password\")\n\n* by_linktxt(target, eager=False, timeout=3, partial=False)\n find_element_by_link_text(target, timeout). if partial=True, then find_element_by_partial_link_text::\n\n >>> br.by_linktxt(\"Go back to\", partial=True)\n\n* href(partialurl=None, eager=False, timeout=3):\n find_element_by_xpath(\"//a\", timeout). if partialurl was given, search 'a' tag which href contains partialurl::\n\n >>> phplinks = br.href(\".php\", eager=True)\n\n* img(alt=None, ext=None, eager=False, timeout=3)\n find_elements_by_xpath(\"//img\", timeout)::\n\n >>> br.img(alt=\"I am sorry\", ext=\"sorry.gif\")\n\n* button(value, eager=False, timeout=3)\n find_element_by_xpath(\"//input[@type='submit' or @type='button' and @value='{0}']|.//button[text()='{0}']\".format(value), timeout)::\n\n >>> br.button(\"Send this form\").click()\n\n* checkbox(self, eager=False, timeout=3, \\*\\*attributes)\n Returns 'input' element type='checkbox'::\n\n >>> br.checkbox(name='checked_value', id='hoge')\n\n* radio(self, eager=False, timeout=3, \\*\\*attributes)\n Retuns 'input' element type='radio'.::\n\n >>> br.radio(name='hoge', id='fuga').click()\n\n* select(self, eager=False, timeout=3, \\*\\*attributes)\n Returns Select(self.by_tag(\"select\", eager, timeout, \\*\\*attributes) or their wrapped SeleniumContainerWrapper::\n\n >>> br.select(name=\"hoge\").select_by_index(1)\n >>> [select.is_multiple for select in br.select(eager=True, name=\"hoge\")]\n\nSeleniumContainerWrapper\n^^^^^^^^^^^^^^^^^^^^^^^^\n\n* size\n Returns length of wrapped iterable::\n\n >>> br.img(eager=True).size\n\n* sample(size)\n Returns random.sample(self._iterable, size)::\n\n >>> br.img(eager=True).sample(10)\n\n* choice()\n Returns random.choice(self._iterable)::\n\n >>> br.img(eager=True).choice()\n\nRecent Change\n-------------\n* 0.5.4\n * Add support for Python-3.4.\n * Fix **button** to look for `