diff --git a/hw2/grab-data.ipynb b/hw2/grab-data.ipynb new file mode 100644 index 0000000..ff08250 --- /dev/null +++ b/hw2/grab-data.ipynb @@ -0,0 +1,443 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import requests\n", + "from bs4 import BeautifulSoup" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "outputs": [], + "source": [ + "URL = \"http://zpp.rospotrebnadzor.ru/Forum/Appeals\"\n", + "page = requests.get(URL)\n", + "\n", + "soup = BeautifulSoup(page.content, \"html.parser\")" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 19, + "outputs": [], + "source": [ + "results = soup.find_all(\"a\", class_=\"appeal-title-link\")" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 25, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Заявление-разьяснение\n", + "/Forum/Appeals/Details/30056\n", + "Уклонение от исполнения договора\n", + "/Forum/Appeals/Details/30047\n", + "торговля подделкой красной икры\n", + "/Forum/Appeals/Details/30043\n", + "Вопрос о втором законопроекте\n", + "/Forum/Appeals/Details/30037\n", + "Мошенники\n", + "/Forum/Appeals/Details/30016\n" + ] + } + ], + "source": [ + "for result in results:\n", + " print(result.text.strip())\n", + " print(result['href'])" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 46, + "outputs": [], + "source": [ + "import re" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 24, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\wirze\\AppData\\Local\\Temp/ipykernel_19516/3836423068.py:7: DeprecationWarning: executable_path has been deprecated, please pass in a Service object\n", + " driver = webdriver.Chrome(\"C:\\\\Users\\\\wirze\\\\DataspellProjects\\\\chromedriver_win32\\\\chromedriver.exe\")\n" + ] + } + ], + "source": [ + "from selenium import webdriver\n", + "from selenium.webdriver.common.keys import Keys\n", + "from selenium.webdriver.common.by import By\n", + "from selenium.webdriver.support.ui import WebDriverWait\n", + "from selenium.webdriver.support import expected_conditions as EC\n", + "\n", + "driver = webdriver.Chrome(\"C:\\\\Users\\\\wirze\\\\DataspellProjects\\\\chromedriver_win32\\\\chromedriver.exe\")\n", + "driver.get(\"http://zpp.rospotrebnadzor.ru/Forum/Appeals\")\n", + "javaScript = \"PagerNextClick();\"\n", + "# driver.get(\"http://zpp.rospotrebnadzor.ru/Forum/Appeals\")\n", + "# # assert \"Python\" in driver.title\n", + "# elem = driver.find_element(\"appeal-title-link\")\n", + "# elem.clear()\n", + "# elem.send_keys(\"pycon\")\n", + "# elem.send_keys(Keys.RETURN)\n", + "# assert \"No results found.\" not in driver.page_source\n", + "# driver.close()" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 47, + "outputs": [ + { + "ename": "MaxRetryError", + "evalue": "HTTPConnectionPool(host='localhost', port=64240): Max retries exceeded with url: /session/6c872595dd4d0a6b6077532b0ed1aba2/source (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))", + "output_type": "error", + "traceback": [ + "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[1;31mConnectionRefusedError\u001B[0m Traceback (most recent call last)", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\connection.py\u001B[0m in \u001B[0;36m_new_conn\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 158\u001B[0m \u001B[1;32mtry\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 159\u001B[1;33m conn = connection.create_connection(\n\u001B[0m\u001B[0;32m 160\u001B[0m \u001B[1;33m(\u001B[0m\u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0m_dns_host\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mport\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mtimeout\u001B[0m\u001B[1;33m,\u001B[0m \u001B[1;33m**\u001B[0m\u001B[0mextra_kw\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\util\\connection.py\u001B[0m in \u001B[0;36mcreate_connection\u001B[1;34m(address, timeout, source_address, socket_options)\u001B[0m\n\u001B[0;32m 83\u001B[0m \u001B[1;32mif\u001B[0m \u001B[0merr\u001B[0m \u001B[1;32mis\u001B[0m \u001B[1;32mnot\u001B[0m \u001B[1;32mNone\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m---> 84\u001B[1;33m \u001B[1;32mraise\u001B[0m \u001B[0merr\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 85\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\util\\connection.py\u001B[0m in \u001B[0;36mcreate_connection\u001B[1;34m(address, timeout, source_address, socket_options)\u001B[0m\n\u001B[0;32m 73\u001B[0m \u001B[0msock\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mbind\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0msource_address\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m---> 74\u001B[1;33m \u001B[0msock\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mconnect\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0msa\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 75\u001B[0m \u001B[1;32mreturn\u001B[0m \u001B[0msock\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;31mConnectionRefusedError\u001B[0m: [WinError 10061] No connection could be made because the target machine actively refused it", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001B[1;31mNewConnectionError\u001B[0m Traceback (most recent call last)", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\u001B[0m in \u001B[0;36murlopen\u001B[1;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001B[0m\n\u001B[0;32m 669\u001B[0m \u001B[1;31m# Make the request on the httplib connection object.\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 670\u001B[1;33m httplib_response = self._make_request(\n\u001B[0m\u001B[0;32m 671\u001B[0m \u001B[0mconn\u001B[0m\u001B[1;33m,\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\u001B[0m in \u001B[0;36m_make_request\u001B[1;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001B[0m\n\u001B[0;32m 391\u001B[0m \u001B[1;32melse\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 392\u001B[1;33m \u001B[0mconn\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mrequest\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[1;33m**\u001B[0m\u001B[0mhttplib_request_kw\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 393\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\http\\client.py\u001B[0m in \u001B[0;36mrequest\u001B[1;34m(self, method, url, body, headers, encode_chunked)\u001B[0m\n\u001B[0;32m 1254\u001B[0m \u001B[1;34m\"\"\"Send a complete request to the server.\"\"\"\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m-> 1255\u001B[1;33m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0m_send_request\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mbody\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mheaders\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mencode_chunked\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 1256\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\http\\client.py\u001B[0m in \u001B[0;36m_send_request\u001B[1;34m(self, method, url, body, headers, encode_chunked)\u001B[0m\n\u001B[0;32m 1300\u001B[0m \u001B[0mbody\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0m_encode\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mbody\u001B[0m\u001B[1;33m,\u001B[0m \u001B[1;34m'body'\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m-> 1301\u001B[1;33m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mendheaders\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mbody\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mencode_chunked\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0mencode_chunked\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 1302\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\http\\client.py\u001B[0m in \u001B[0;36mendheaders\u001B[1;34m(self, message_body, encode_chunked)\u001B[0m\n\u001B[0;32m 1249\u001B[0m \u001B[1;32mraise\u001B[0m \u001B[0mCannotSendHeader\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m-> 1250\u001B[1;33m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0m_send_output\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mmessage_body\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mencode_chunked\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0mencode_chunked\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 1251\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\http\\client.py\u001B[0m in \u001B[0;36m_send_output\u001B[1;34m(self, message_body, encode_chunked)\u001B[0m\n\u001B[0;32m 1009\u001B[0m \u001B[1;32mdel\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0m_buffer\u001B[0m\u001B[1;33m[\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m]\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m-> 1010\u001B[1;33m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0msend\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mmsg\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 1011\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\http\\client.py\u001B[0m in \u001B[0;36msend\u001B[1;34m(self, data)\u001B[0m\n\u001B[0;32m 949\u001B[0m \u001B[1;32mif\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mauto_open\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 950\u001B[1;33m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mconnect\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 951\u001B[0m \u001B[1;32melse\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\connection.py\u001B[0m in \u001B[0;36mconnect\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 186\u001B[0m \u001B[1;32mdef\u001B[0m \u001B[0mconnect\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mself\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 187\u001B[1;33m \u001B[0mconn\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0m_new_conn\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 188\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0m_prepare_conn\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mconn\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\connection.py\u001B[0m in \u001B[0;36m_new_conn\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 170\u001B[0m \u001B[1;32mexcept\u001B[0m \u001B[0mSocketError\u001B[0m \u001B[1;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 171\u001B[1;33m raise NewConnectionError(\n\u001B[0m\u001B[0;32m 172\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m,\u001B[0m \u001B[1;34m\"Failed to establish a new connection: %s\"\u001B[0m \u001B[1;33m%\u001B[0m \u001B[0me\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;31mNewConnectionError\u001B[0m: : Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001B[1;31mMaxRetryError\u001B[0m Traceback (most recent call last)", + "\u001B[1;32m~\\AppData\\Local\\Temp/ipykernel_19516/3232448368.py\u001B[0m in \u001B[0;36m\u001B[1;34m\u001B[0m\n\u001B[1;32m----> 1\u001B[1;33m \u001B[0mhtml\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mdriver\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mpage_source\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 2\u001B[0m \u001B[0msoup\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mBeautifulSoup\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mhtml\u001B[0m\u001B[1;33m,\u001B[0m \u001B[1;34m\"html.parser\"\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 3\u001B[0m \u001B[0mresults\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0msoup\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mfind_all\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;34m\"a\"\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mclass_\u001B[0m\u001B[1;33m=\u001B[0m\u001B[1;34m\"appeal-title-link\"\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 4\u001B[0m \u001B[1;32mfor\u001B[0m \u001B[0mresult\u001B[0m \u001B[1;32min\u001B[0m \u001B[0mresults\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 5\u001B[0m \u001B[1;31m# print(result.text.strip())\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001B[0m in \u001B[0;36mpage_source\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 918\u001B[0m \u001B[0mdriver\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mpage_source\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 919\u001B[0m \"\"\"\n\u001B[1;32m--> 920\u001B[1;33m \u001B[1;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mexecute\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mCommand\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mGET_PAGE_SOURCE\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m[\u001B[0m\u001B[1;34m'value'\u001B[0m\u001B[1;33m]\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 921\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 922\u001B[0m \u001B[1;32mdef\u001B[0m \u001B[0mclose\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mself\u001B[0m\u001B[1;33m)\u001B[0m \u001B[1;33m->\u001B[0m \u001B[1;32mNone\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\u001B[0m in \u001B[0;36mexecute\u001B[1;34m(self, driver_command, params)\u001B[0m\n\u001B[0;32m 414\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 415\u001B[0m \u001B[0mparams\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0m_wrap_value\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mparams\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 416\u001B[1;33m \u001B[0mresponse\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mcommand_executor\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mexecute\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mdriver_command\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mparams\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 417\u001B[0m \u001B[1;32mif\u001B[0m \u001B[0mresponse\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 418\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0merror_handler\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mcheck_response\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mresponse\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\remote_connection.py\u001B[0m in \u001B[0;36mexecute\u001B[1;34m(self, command, params)\u001B[0m\n\u001B[0;32m 396\u001B[0m \u001B[0mdata\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mutils\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mdump_json\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mparams\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 397\u001B[0m \u001B[0murl\u001B[0m \u001B[1;33m=\u001B[0m \u001B[1;34mf\"{self._url}{path}\"\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 398\u001B[1;33m \u001B[1;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0m_request\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mcommand_info\u001B[0m\u001B[1;33m[\u001B[0m\u001B[1;36m0\u001B[0m\u001B[1;33m]\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mbody\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0mdata\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 399\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 400\u001B[0m \u001B[1;32mdef\u001B[0m \u001B[0m_request\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mself\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mbody\u001B[0m\u001B[1;33m=\u001B[0m\u001B[1;32mNone\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\selenium\\webdriver\\remote\\remote_connection.py\u001B[0m in \u001B[0;36m_request\u001B[1;34m(self, method, url, body)\u001B[0m\n\u001B[0;32m 418\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 419\u001B[0m \u001B[1;32mif\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mkeep_alive\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 420\u001B[1;33m \u001B[0mresp\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0m_conn\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mrequest\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mbody\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0mbody\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mheaders\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0mheaders\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 421\u001B[0m \u001B[0mstatuscode\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mresp\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mstatus\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 422\u001B[0m \u001B[1;32melse\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\request.py\u001B[0m in \u001B[0;36mrequest\u001B[1;34m(self, method, url, fields, headers, **urlopen_kw)\u001B[0m\n\u001B[0;32m 73\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 74\u001B[0m \u001B[1;32mif\u001B[0m \u001B[0mmethod\u001B[0m \u001B[1;32min\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0m_encode_url_methods\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m---> 75\u001B[1;33m return self.request_encode_url(\n\u001B[0m\u001B[0;32m 76\u001B[0m \u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mfields\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0mfields\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mheaders\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0mheaders\u001B[0m\u001B[1;33m,\u001B[0m \u001B[1;33m**\u001B[0m\u001B[0murlopen_kw\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 77\u001B[0m )\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\request.py\u001B[0m in \u001B[0;36mrequest_encode_url\u001B[1;34m(self, method, url, fields, headers, **urlopen_kw)\u001B[0m\n\u001B[0;32m 95\u001B[0m \u001B[0murl\u001B[0m \u001B[1;33m+=\u001B[0m \u001B[1;34m\"?\"\u001B[0m \u001B[1;33m+\u001B[0m \u001B[0murlencode\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mfields\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 96\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m---> 97\u001B[1;33m \u001B[1;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0murlopen\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[1;33m**\u001B[0m\u001B[0mextra_kw\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 98\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 99\u001B[0m def request_encode_body(\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\poolmanager.py\u001B[0m in \u001B[0;36murlopen\u001B[1;34m(self, method, url, redirect, **kw)\u001B[0m\n\u001B[0;32m 334\u001B[0m \u001B[0mresponse\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mconn\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0murlopen\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[1;33m**\u001B[0m\u001B[0mkw\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 335\u001B[0m \u001B[1;32melse\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 336\u001B[1;33m \u001B[0mresponse\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mconn\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0murlopen\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mu\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mrequest_uri\u001B[0m\u001B[1;33m,\u001B[0m \u001B[1;33m**\u001B[0m\u001B[0mkw\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 337\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 338\u001B[0m \u001B[0mredirect_location\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mredirect\u001B[0m \u001B[1;32mand\u001B[0m \u001B[0mresponse\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mget_redirect_location\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\u001B[0m in \u001B[0;36murlopen\u001B[1;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001B[0m\n\u001B[0;32m 752\u001B[0m \u001B[1;34m\"Retrying (%r) after connection broken by '%r': %s\"\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mretries\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0merr\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 753\u001B[0m )\n\u001B[1;32m--> 754\u001B[1;33m return self.urlopen(\n\u001B[0m\u001B[0;32m 755\u001B[0m \u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 756\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\u001B[0m in \u001B[0;36murlopen\u001B[1;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001B[0m\n\u001B[0;32m 752\u001B[0m \u001B[1;34m\"Retrying (%r) after connection broken by '%r': %s\"\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mretries\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0merr\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 753\u001B[0m )\n\u001B[1;32m--> 754\u001B[1;33m return self.urlopen(\n\u001B[0m\u001B[0;32m 755\u001B[0m \u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 756\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\u001B[0m in \u001B[0;36murlopen\u001B[1;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001B[0m\n\u001B[0;32m 752\u001B[0m \u001B[1;34m\"Retrying (%r) after connection broken by '%r': %s\"\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mretries\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0merr\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 753\u001B[0m )\n\u001B[1;32m--> 754\u001B[1;33m return self.urlopen(\n\u001B[0m\u001B[0;32m 755\u001B[0m \u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 756\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\u001B[0m in \u001B[0;36murlopen\u001B[1;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001B[0m\n\u001B[0;32m 724\u001B[0m \u001B[0me\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mProtocolError\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;34m\"Connection aborted.\"\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0me\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 725\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 726\u001B[1;33m retries = retries.increment(\n\u001B[0m\u001B[0;32m 727\u001B[0m \u001B[0mmethod\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0merror\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0me\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0m_pool\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0mself\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0m_stacktrace\u001B[0m\u001B[1;33m=\u001B[0m\u001B[0msys\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mexc_info\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m[\u001B[0m\u001B[1;36m2\u001B[0m\u001B[1;33m]\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 728\u001B[0m )\n", + "\u001B[1;32m~\\anaconda3\\lib\\site-packages\\urllib3\\util\\retry.py\u001B[0m in \u001B[0;36mincrement\u001B[1;34m(self, method, url, response, error, _pool, _stacktrace)\u001B[0m\n\u001B[0;32m 444\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 445\u001B[0m \u001B[1;32mif\u001B[0m \u001B[0mnew_retry\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mis_exhausted\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m:\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m--> 446\u001B[1;33m \u001B[1;32mraise\u001B[0m \u001B[0mMaxRetryError\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0m_pool\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0merror\u001B[0m \u001B[1;32mor\u001B[0m \u001B[0mResponseError\u001B[0m\u001B[1;33m(\u001B[0m\u001B[0mcause\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m 447\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 448\u001B[0m \u001B[0mlog\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mdebug\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;34m\"Incremented Retry for (url='%s'): %r\"\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0murl\u001B[0m\u001B[1;33m,\u001B[0m \u001B[0mnew_retry\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n", + "\u001B[1;31mMaxRetryError\u001B[0m: HTTPConnectionPool(host='localhost', port=64240): Max retries exceeded with url: /session/6c872595dd4d0a6b6077532b0ed1aba2/source (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))" + ] + } + ], + "source": [ + "html = driver.page_source\n", + "soup = BeautifulSoup(html, \"html.parser\")\n", + "results = soup.find_all(\"a\", class_=\"appeal-title-link\")\n", + "for result in results:\n", + " # print(result.text.strip())\n", + " # print(result['href']\n", + " print(re.findall(r'\\d+', result['href']))\n", + " # [int(s) for s in result['href'].split() if s.isdigit()]" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 57, + "outputs": [ + { + "data": { + "text/plain": "'29982'" + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "re.findall(r'\\d+', result['href'])[0]" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 59, + "outputs": [ + { + "data": { + "text/plain": "29982" + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "int(re.findall(r'\\d+', result['href'])[0])" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 63, + "outputs": [], + "source": [ + "links = {}\n", + "for result in results:\n", + " links[re.findall(r'\\d+', result['href'])[0]] = result['href']" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 64, + "outputs": [ + { + "data": { + "text/plain": "{'29982': '/Forum/Appeals/Details/29982',\n '29981': '/Forum/Appeals/Details/29981',\n '29979': '/Forum/Appeals/Details/29979',\n '29976': '/Forum/Appeals/Details/29976',\n '29972': '/Forum/Appeals/Details/29972'}" + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "links" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "links" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 40, + "outputs": [], + "source": [ + "driver.execute_script(javaScript)" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 42, + "outputs": [], + "source": [ + "driver.quit()" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 22, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\wirze\\AppData\\Local\\Temp/ipykernel_19516/473801397.py:7: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead\n", + " first_page = driver.find_element_by_class_name(\"appeal-title-link\")\n" + ] + } + ], + "source": [ + "# driver.get(\"http://zpp.rospotrebnadzor.ru/Forum/Appeals\")\n", + "# javaScript = \"PagerNextClick();\"\n", + "\n", + "try:\n", + "# element = WebDriverWait(driver, 1).until(\n", + "# EC.presence_of_element_located((By.ID, \"appeal-title-link\"))\n", + "# )\n", + "# first_page = driver.find_element_by_class_name(\"appeal-title-link\")\n", + " for i in range(10):\n", + " WebDriverWait(driver, 2).execute_script(javaScript)\n", + "finally:\n", + " driver.quit()" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 23, + "outputs": [ + { + "data": { + "text/plain": "" + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "first_page" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "javaScript = \"PagerNextClick();\"\n", + "for i in range(10):\n", + " WebDriverWait(driver, 2).execute_script(javaScript)" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, + { + "cell_type": "code", + "execution_count": 14, + "outputs": [], + "source": [ + "driver.close()" + ], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file