{"action":"created","issue":{"url":"https://api.github.com/repos/2gis/contesto/issues/67","labels_url":"https://api.github.com/repos/2gis/contesto/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/2gis/contesto/issues/67/comments","events_url":"https://api.github.com/repos/2gis/contesto/issues/67/events","html_url":"https://github.com/2gis/contesto/issues/67","id":119668755,"number":67,"title":"Не ловиться ElementNotFound, когда нет элемента","user":{"login":"MihaylovNikitos","id":11960148,"avatar_url":"https://avatars.githubusercontent.com/u/11960148?v=3","gravatar_id":"","url":"https://api.github.com/users/MihaylovNikitos","html_url":"https://github.com/MihaylovNikitos","followers_url":"https://api.github.com/users/MihaylovNikitos/followers","following_url":"https://api.github.com/users/MihaylovNikitos/following{/other_user}","gists_url":"https://api.github.com/users/MihaylovNikitos/gists{/gist_id}","starred_url":"https://api.github.com/users/MihaylovNikitos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MihaylovNikitos/subscriptions","organizations_url":"https://api.github.com/users/MihaylovNikitos/orgs","repos_url":"https://api.github.com/users/MihaylovNikitos/repos","events_url":"https://api.github.com/users/MihaylovNikitos/events{/privacy}","received_events_url":"https://api.github.com/users/MihaylovNikitos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-01T08:46:34Z","updated_at":"2015-12-18T09:06:32Z","closed_at":null,"body":"В новой версии, не ловится ElementNotFound, когда нет элемента.\r\nВ старой версии(на @53ff11259171a8fca74cbc04bf83bbdec668424d) ловится.\r\nВерсия python неважна, Selenium стоит 2.48.0.\r\n\r\nЗаместо него летит selenium.common.exceptions.NoSuchElementException(что интересно, т.к в Selenium он должен игнорироватся\r\nhttps://github.com/SeleniumHQ/selenium/blob/master/py/selenium/webdriver/support/wait.py#L50\r\nhttps://github.com/SeleniumHQ/selenium/blob/master/py/selenium/webdriver/support/wait.py#L74\r\n\r\nН-р воспроизводится тестах:\r\n[test_open_close_gallery](https://github.com/2gis/online4/blob/b9d53ac348fe1839a7b7de1a3f0a926a793bb67a/functional-tests/tests/search/photos.py#L38)\r\n[test_building_name_drilldown_verify](https://github.com/2gis/online4/blob/c134a6ba4265a74eb796b7540cb96687b37c63ea/functional-tests/tests/search/minicards.py#L148)\r\nИх можно легко найти: , none()\r\n\r\nОшибка:\r\n```\r\n======================================================================\r\nERROR: test_building_name_drilldown_verify_('Красный проспект 71 <slash>', 'building', '<slash>novosibirsk') (search.minicards.TestMiniCard)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/.tox/lib/python3.4/site-packages/lode_runner/plugins/initializer.py\", line 18, in wrapper\r\n    result = test(*args, **kwargs)\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/.tox/lib/python3.4/site-packages/lode_runner/plugins/dataprovider.py\", line 254, in <lambda>\r\n    standalone_func = lambda *args: func(*(args + data_set))\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/tests/search/minicards.py\", line 162, in test_building_name_drilldown_verify\r\n    self.page.search_results.select_geo_tab()\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/classes/components/frame/frame.py\", line 123, in select_geo_tab\r\n    if self.wizard is not None:\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/classes/util/decorators.py\", line 16, in decorated\r\n    return f(self, *args, **kwargs)\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/classes/components/frame/frame.py\", line 156, in wizard\r\n    return Wizard(self.test, container.find_element_by_css_selector(Wizard.selectors['self']))\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/.tox/lib/python3.4/site-packages/selenium/webdriver/remote/webelement.py\", line 277, in find_element_by_css_selector\r\n    return self.find_element(by=By.CSS_SELECTOR, value=css_selector)\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/.tox/lib/python3.4/site-packages/selenium/webdriver/remote/webelement.py\", line 474, in find_element\r\n    {\"using\": by, \"value\": value})['value']\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/.tox/lib/python3.4/site-packages/selenium/webdriver/remote/webelement.py\", line 454, in _execute\r\n    return self._parent.execute(command, params)\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/.tox/lib/python3.4/site-packages/contesto/core/driver.py\", line 59, in execute\r\n    result = super(Driver, self).execute(driver_command, params)\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/.tox/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py\", line 201, in execute\r\n    self.error_handler.check_response(response)\r\n  File \"/home/n.mikhaylov/2gis/online4-for-test/functional-tests/.tox/lib/python3.4/site-packages/selenium/webdriver/remote/errorhandler.py\", line 181, in check_response\r\n    raise exception_class(message, screen, stacktrace)\r\n**selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {\"method\":\"css selector\",\"selector\":\".wizard\"}**\r\n  (Session info: chrome=47.0.2522.1)\r\n  (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 3.13.0-63-generic x86_64) (WARNING: The server did not provide any stacktrace information)\r\nCommand duration or timeout: 10.03 seconds\r\nFor documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html\r\nBuild info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'\r\nSystem info: host: 'uk-rnd-26', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-63-generic', java.version: '1.7.0_79'\r\n*** Element info: {Using=css selector, value=.wizard}\r\nSession ID: 3b53c051ea742175e7b1f064d2f2d740\r\nDriver info: org.openqa.selenium.chrome.ChromeDriver\r\nCapabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/tmp/.com.google.Chrome.2ufUsX}, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=47.0.2522.1, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, hasTouchScreen=false, applicationCacheEnabled=false, takesScreenshot=true}]\r\nScreenshot: available via screen\r\nStacktrace:\r\n    at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (NativeConstructorAccessorImpl.java:-2)\r\n    at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:57)\r\n    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)\r\n    at java.lang.reflect.Constructor.newInstance (Constructor.java:526)\r\n    at org.openqa.selenium.remote.ErrorHandler.createThrowable (ErrorHandler.java:206)\r\n    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed (ErrorHandler.java:158)\r\n    at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:647)\r\n    at org.openqa.selenium.remote.RemoteWebElement.execute (RemoteWebElement.java:326)\r\n    at org.openqa.selenium.remote.RemoteWebElement.findElement (RemoteWebElement.java:197)\r\n    at org.openqa.selenium.remote.RemoteWebElement.findElementByCssSelector (RemoteWebElement.java:286)\r\n    at org.openqa.selenium.By$ByCssSelector.findElement (By.java:430)\r\n    at org.openqa.selenium.remote.RemoteWebElement.findElement (RemoteWebElement.java:193)\r\n    at sun.reflect.GeneratedMethodAccessor19.invoke (None:-1)\r\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)\r\n    at java.lang.reflect.Method.invoke (Method.java:606)\r\n    at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement$1.invoke (EventFiringWebDriver.java:334)\r\n    at com.sun.proxy.$Proxy2.findElement (None:-1)\r\n    at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.findElement (EventFiringWebDriver.java:405)\r\n    at sun.reflect.GeneratedMethodAccessor19.invoke (None:-1)\r\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)\r\n    at java.lang.reflect.Method.invoke (Method.java:606)\r\n    at org.openqa.selenium.remote.server.KnownElements$1.invoke (KnownElements.java:64)\r\n    at com.sun.proxy.$Proxy3.findElement (None:-1)\r\n    at org.openqa.selenium.remote.server.handler.FindChildElement.call (FindChildElement.java:44)\r\n    at org.openqa.selenium.remote.server.handler.FindChildElement.call (FindChildElement.java:1)\r\n    at java.util.concurrent.FutureTask.run (FutureTask.java:262)\r\n    at org.openqa.selenium.remote.server.DefaultSession$1.run (DefaultSession.java:176)\r\n    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)\r\n    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615)\r\n    at java.lang.Thread.run (Thread.java:745)\r\n```"},"comment":{"url":"https://api.github.com/repos/2gis/contesto/issues/comments/165718778","html_url":"https://github.com/2gis/contesto/issues/67#issuecomment-165718778","issue_url":"https://api.github.com/repos/2gis/contesto/issues/67","id":165718778,"user":{"login":"nwlunatic","id":428397,"avatar_url":"https://avatars.githubusercontent.com/u/428397?v=3","gravatar_id":"","url":"https://api.github.com/users/nwlunatic","html_url":"https://github.com/nwlunatic","followers_url":"https://api.github.com/users/nwlunatic/followers","following_url":"https://api.github.com/users/nwlunatic/following{/other_user}","gists_url":"https://api.github.com/users/nwlunatic/gists{/gist_id}","starred_url":"https://api.github.com/users/nwlunatic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwlunatic/subscriptions","organizations_url":"https://api.github.com/users/nwlunatic/orgs","repos_url":"https://api.github.com/users/nwlunatic/repos","events_url":"https://api.github.com/users/nwlunatic/events{/privacy}","received_events_url":"https://api.github.com/users/nwlunatic/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T09:06:32Z","updated_at":"2015-12-18T09:06:32Z","body":"@rseek прав. В этом месте мы сломали обратную совместимость, чтобы не отбирать возможность использовать стандартные средства selenium не monkey patch'а их.\r\n\r\nпоэтому теперь существует отдельный способ поиска элементов: \r\nhttp://contesto.readthedocs.org/en/master/finder.html#module-contesto\r\n\r\nможно вручную сделать такой же monkey patch где-то в инициализации:\r\n```python\r\nfrom contesto import find_element, find_elements, ContestoWebDriver, ContestoWebElement\r\nContestoWebDriver.find_element = find_element\r\nContestoWebDriver.find_elements = find_elements\r\nContestoWebElement.find_element = find_element\r\nContestoWebElement.find_elements = find_elements\r\n```"}}