Skip to content

Commit

Permalink
Update requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
fedebotu committed Aug 29, 2023
1 parent 0c63725 commit 4cfc1c7
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 61 deletions.
101 changes: 46 additions & 55 deletions GUI debug.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@
},
{
"cell_type": "code",
"execution_count": 122,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
Expand All @@ -41,20 +32,20 @@
"from selenium.webdriver.chrome.service import Service\n",
"\n",
"# from kaist.navigation.video import watch_lessons\n",
"from kaist.navigation.quiz import run_quiz\n",
"from kaist.navigation.login import portal_login\n",
"from kaist.navigation.utils import save_debug, check_education_end, alert_accept, click_all_until_done\n",
"from kaist.utils import ThreadWithException\n",
"# from src.navigation.quiz import run_quiz\n",
"from src.navigation.login import portal_login\n",
"from src.navigation.utils import save_debug, check_education_end, alert_accept, click_all_until_done\n",
"from src.utils import ThreadWithException\n",
"import time\n",
"\n",
"from kaist.navigation.webdriver import setup_webdriver\n",
"from kaist.utils import ThreadWithException\n",
"from src.navigation.webdriver import setup_webdriver\n",
"from src.utils import ThreadWithException\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 130,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -72,34 +63,16 @@
},
{
"cell_type": "code",
"execution_count": 136,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[WDM] - ====== WebDriver manager ======\n",
"[WDM] - Current google-chrome version is 106.0.5249\n",
"[WDM] - Get LATEST chromedriver version for 106.0.5249 google-chrome\n",
"[WDM] - Driver [/home/botu/.wdm/drivers/chromedriver/linux64/106.0.5249.61/chromedriver] found in cache\n"
]
}
],
"outputs": [],
"source": [
"driver = setup_webdriver('chrome')"
]
},
{
"cell_type": "code",
"execution_count": 137,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand All @@ -108,9 +81,27 @@
"text": [
"Automatic login\n",
"Authenticate login with your phone. Alternatively, you can use the opened browser to navigate.\n",
"Waiting for login... Will timeout after `timeout` seconds\n",
"Automatic login failed. Trying manual login...\n",
"Manual login\n",
"Please login manually. You can use the opened browser to navigate the page.\n",
"Waiting for the button to be visible... You may need to maximize the window\n"
]
},
{
"ename": "UnexpectedAlertPresentException",
"evalue": "Alert Text: 앞서 요청하신 간편인증이 진행중입니다. 모바일앱에서 인증을 수행해주세요.\nMessage: unexpected alert open: {Alert text : 앞서 요청하신 간편인증이 진행중입니다. 모바일앱에서 인증을 수행해주세요.}\n (Session info: chrome=116.0.5845.110)\nStacktrace:\n#0 0x563f44bb1e23 <unknown>\n#1 0x563f448da7a7 <unknown>\n#2 0x563f44952a13 <unknown>\n#3 0x563f44939de3 <unknown>\n#4 0x563f4490da7b <unknown>\n#5 0x563f4490e81e <unknown>\n#6 0x563f44b73638 <unknown>\n#7 0x563f44b77507 <unknown>\n#8 0x563f44b81c4c <unknown>\n#9 0x563f44b78136 <unknown>\n#10 0x563f44b469cf <unknown>\n#11 0x563f44b9bb98 <unknown>\n#12 0x563f44b9bd68 <unknown>\n#13 0x563f44baacb3 <unknown>\n#14 0x7f1dfa28f18a <unknown>\n",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mUnexpectedAlertPresentException\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[4], line 9\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39m'\u001b[39m\u001b[39mWaiting for the button to be visible... You may need to maximize the window\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[1;32m 8\u001b[0m driver\u001b[39m.\u001b[39mmaximize_window()\n\u001b[0;32m----> 9\u001b[0m WebDriverWait(driver, timeout\u001b[39m=\u001b[39;49m\u001b[39m60\u001b[39;49m, poll_frequency\u001b[39m=\u001b[39;49m\u001b[39m1\u001b[39;49m)\u001b[39m.\u001b[39;49muntil(EC\u001b[39m.\u001b[39;49melement_to_be_clickable((By\u001b[39m.\u001b[39;49mID, \u001b[39m'\u001b[39;49m\u001b[39meduGo\u001b[39;49m\u001b[39m'\u001b[39;49m)))\n\u001b[1;32m 10\u001b[0m button \u001b[39m=\u001b[39m driver\u001b[39m.\u001b[39mfind_element(by\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39mid\u001b[39m\u001b[39m'\u001b[39m, value\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39meduGo\u001b[39m\u001b[39m'\u001b[39m) \u001b[39m# click button to go to page\u001b[39;00m\n\u001b[1;32m 11\u001b[0m button\u001b[39m.\u001b[39mclick()\n",
"File \u001b[0;32m~/anaconda3/envs/kaist/lib/python3.11/site-packages/selenium/webdriver/support/wait.py:86\u001b[0m, in \u001b[0;36mWebDriverWait.until\u001b[0;34m(self, method, message)\u001b[0m\n\u001b[1;32m 84\u001b[0m \u001b[39mwhile\u001b[39;00m \u001b[39mTrue\u001b[39;00m:\n\u001b[1;32m 85\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[0;32m---> 86\u001b[0m value \u001b[39m=\u001b[39m method(\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_driver)\n\u001b[1;32m 87\u001b[0m \u001b[39mif\u001b[39;00m value:\n\u001b[1;32m 88\u001b[0m \u001b[39mreturn\u001b[39;00m value\n",
"File \u001b[0;32m~/anaconda3/envs/kaist/lib/python3.11/site-packages/selenium/webdriver/support/expected_conditions.py:355\u001b[0m, in \u001b[0;36melement_to_be_clickable.<locals>._predicate\u001b[0;34m(driver)\u001b[0m\n\u001b[1;32m 353\u001b[0m target \u001b[39m=\u001b[39m mark\n\u001b[1;32m 354\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39misinstance\u001b[39m(target, WebElement): \u001b[39m# if given locator instead of WebElement\u001b[39;00m\n\u001b[0;32m--> 355\u001b[0m target \u001b[39m=\u001b[39m driver\u001b[39m.\u001b[39;49mfind_element(\u001b[39m*\u001b[39;49mtarget) \u001b[39m# grab element at locator\u001b[39;00m\n\u001b[1;32m 356\u001b[0m target \u001b[39m=\u001b[39m visibility_of(target)(driver)\n\u001b[1;32m 357\u001b[0m \u001b[39mif\u001b[39;00m target \u001b[39mand\u001b[39;00m target\u001b[39m.\u001b[39mis_enabled():\n",
"File \u001b[0;32m~/anaconda3/envs/kaist/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:739\u001b[0m, in \u001b[0;36mWebDriver.find_element\u001b[0;34m(self, by, value)\u001b[0m\n\u001b[1;32m 736\u001b[0m by \u001b[39m=\u001b[39m By\u001b[39m.\u001b[39mCSS_SELECTOR\n\u001b[1;32m 737\u001b[0m value \u001b[39m=\u001b[39m \u001b[39mf\u001b[39m\u001b[39m'\u001b[39m\u001b[39m[name=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m{\u001b[39;00mvalue\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m\u001b[39m]\u001b[39m\u001b[39m'\u001b[39m\n\u001b[0;32m--> 739\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mexecute(Command\u001b[39m.\u001b[39;49mFIND_ELEMENT, {\u001b[39m\"\u001b[39;49m\u001b[39musing\u001b[39;49m\u001b[39m\"\u001b[39;49m: by, \u001b[39m\"\u001b[39;49m\u001b[39mvalue\u001b[39;49m\u001b[39m\"\u001b[39;49m: value})[\u001b[39m\"\u001b[39m\u001b[39mvalue\u001b[39m\u001b[39m\"\u001b[39m]\n",
"File \u001b[0;32m~/anaconda3/envs/kaist/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:345\u001b[0m, in \u001b[0;36mWebDriver.execute\u001b[0;34m(self, driver_command, params)\u001b[0m\n\u001b[1;32m 343\u001b[0m response \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mcommand_executor\u001b[39m.\u001b[39mexecute(driver_command, params)\n\u001b[1;32m 344\u001b[0m \u001b[39mif\u001b[39;00m response:\n\u001b[0;32m--> 345\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49merror_handler\u001b[39m.\u001b[39;49mcheck_response(response)\n\u001b[1;32m 346\u001b[0m response[\u001b[39m\"\u001b[39m\u001b[39mvalue\u001b[39m\u001b[39m\"\u001b[39m] \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_unwrap_value(response\u001b[39m.\u001b[39mget(\u001b[39m\"\u001b[39m\u001b[39mvalue\u001b[39m\u001b[39m\"\u001b[39m, \u001b[39mNone\u001b[39;00m))\n\u001b[1;32m 347\u001b[0m \u001b[39mreturn\u001b[39;00m response\n",
"File \u001b[0;32m~/anaconda3/envs/kaist/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py:228\u001b[0m, in \u001b[0;36mErrorHandler.check_response\u001b[0;34m(self, response)\u001b[0m\n\u001b[1;32m 226\u001b[0m \u001b[39melif\u001b[39;00m \u001b[39m\"\u001b[39m\u001b[39malert\u001b[39m\u001b[39m\"\u001b[39m \u001b[39min\u001b[39;00m value:\n\u001b[1;32m 227\u001b[0m alert_text \u001b[39m=\u001b[39m value[\u001b[39m\"\u001b[39m\u001b[39malert\u001b[39m\u001b[39m\"\u001b[39m]\u001b[39m.\u001b[39mget(\u001b[39m\"\u001b[39m\u001b[39mtext\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[0;32m--> 228\u001b[0m \u001b[39mraise\u001b[39;00m exception_class(message, screen, stacktrace, alert_text) \u001b[39m# type: ignore[call-arg] # mypy is not smart enough here\u001b[39;00m\n\u001b[1;32m 229\u001b[0m \u001b[39mraise\u001b[39;00m exception_class(message, screen, stacktrace)\n",
"\u001b[0;31mUnexpectedAlertPresentException\u001b[0m: Alert Text: 앞서 요청하신 간편인증이 진행중입니다. 모바일앱에서 인증을 수행해주세요.\nMessage: unexpected alert open: {Alert text : 앞서 요청하신 간편인증이 진행중입니다. 모바일앱에서 인증을 수행해주세요.}\n (Session info: chrome=116.0.5845.110)\nStacktrace:\n#0 0x563f44bb1e23 <unknown>\n#1 0x563f448da7a7 <unknown>\n#2 0x563f44952a13 <unknown>\n#3 0x563f44939de3 <unknown>\n#4 0x563f4490da7b <unknown>\n#5 0x563f4490e81e <unknown>\n#6 0x563f44b73638 <unknown>\n#7 0x563f44b77507 <unknown>\n#8 0x563f44b81c4c <unknown>\n#9 0x563f44b78136 <unknown>\n#10 0x563f44b469cf <unknown>\n#11 0x563f44b9bb98 <unknown>\n#12 0x563f44b9bd68 <unknown>\n#13 0x563f44baacb3 <unknown>\n#14 0x7f1dfa28f18a <unknown>\n"
]
}
],
"source": [
Expand Down Expand Up @@ -146,7 +137,7 @@
},
{
"cell_type": "code",
"execution_count": 58,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -175,7 +166,7 @@
},
{
"cell_type": "code",
"execution_count": 59,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -184,7 +175,7 @@
},
{
"cell_type": "code",
"execution_count": 60,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -201,7 +192,7 @@
},
{
"cell_type": "code",
"execution_count": 61,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -226,7 +217,7 @@
},
{
"cell_type": "code",
"execution_count": 62,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -235,7 +226,7 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -264,7 +255,7 @@
},
{
"cell_type": "code",
"execution_count": 126,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -276,7 +267,7 @@
},
{
"cell_type": "code",
"execution_count": 128,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -301,7 +292,7 @@
},
{
"cell_type": "code",
"execution_count": 129,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -323,7 +314,7 @@
},
{
"cell_type": "code",
"execution_count": 77,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -341,7 +332,7 @@
},
{
"cell_type": "code",
"execution_count": 141,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -475,7 +466,7 @@
},
{
"cell_type": "code",
"execution_count": 135,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -571,7 +562,7 @@
},
{
"cell_type": "code",
"execution_count": 116,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -581,7 +572,7 @@
},
{
"cell_type": "code",
"execution_count": 120,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -615,7 +606,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.11.4"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PySimpleGUI==4.60.3
darkdetect==0.7.1
requests==2.28.1
selenium==4.5.0
python-dotenv==0.21.0
PySimpleGUI==4.60.5
darkdetect==0.8.0
requests==2.31.0
selenium==4.11.2
python-dotenv==1.0.0
pyyaml

# For webdriver-manager
Expand Down
2 changes: 1 addition & 1 deletion src/navigation/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from webdriver_manager.microsoft import IEDriverManager
from webdriver_manager.microsoft import EdgeChromiumDriverManager
# from webdriver_manager.opera import OperaDriverManager
from webdriver_manager.core.utils import ChromeType
from webdriver_manager.core.os_manager import ChromeType


AVAILABLE_BROWSERS = ['Chrome', 'Chromium', 'Brave', 'Firefox', 'IE', 'Edge']#, 'Opera']
Expand Down

0 comments on commit 4cfc1c7

Please sign in to comment.