You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Tools/Jupyter-notebooks/Modules/Web.ipynb

216 lines
4.7 KiB

2 years ago
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
2 years ago
"metadata": {},
"outputs": [],
2 years ago
"source": [
"import sys\n",
"import os\n",
"#sys.path.insert(0, os.path.abspath(\"..\\\\..\\\\Sources\")) # FOR WINDOWS\n",
"sys.path.insert(0, os.path.abspath(\"../../Sources\")) # FOR LINUX\n",
2 years ago
"from pyOpenRPA.Robot import UIWeb\n",
"UIWeb.BrowserChromeStart()\n",
2 years ago
"UIWeb.PageOpen(\"https://mail.ru\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"lUIOSelectorStr = \"#grid > div.grid-middle > div.grid__main-col.svelte-2y66pa > div.grid_newscol.grid_newscol__more-pulse.svelte-1yvqfic > div.grid__ccol.svelte-1yvqfic > ul > li:nth-child(5) > div > a\"\n",
"lUIOSelectorStr = \"//*[@id=\\\"grid\\\"]/div[2]/div[2]/div[3]/div[1]/ul/li[5]/div/a\"\n",
"UIWeb.UIOSelectorHighlight(lUIOSelectorStr)\n",
"lUIO=UIWeb.UIOSelectorList(lUIOSelectorStr)[0]"
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 5,
2 years ago
"metadata": {},
"outputs": [],
"source": [
"UIWeb.BrowserClose()"
]
},
{
"cell_type": "code",
2 years ago
"execution_count": 4,
2 years ago
"metadata": {},
2 years ago
"outputs": [],
"source": [
2 years ago
" # UIWeb: Взаимодействие с ui web\n",
" from pyOpenRPA.Robot import UIWeb\n",
" #UIWeb.BrowserChromeStart()\n",
" #UIWeb.PageOpen(\"https://mail.ru\")\n",
" UIWeb.PageJSExecute(\"alert(arguments[0]);\", \"hello world!\")"
]
2 years ago
},
{
"cell_type": "code",
"execution_count": 6,
2 years ago
"metadata": {},
"outputs": [],
"source": [
"UIWeb.UIOAttributeSet(lUIO,\"test\", \"asd\")"
]
},
{
"cell_type": "code",
"execution_count": 7,
2 years ago
"metadata": {},
"outputs": [],
"source": [
"UIWeb.UIOAttributeRemove(lUIO, \"test\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
2 years ago
"metadata": {},
"outputs": [],
"source": [
"UIWeb.UIOAttributeStyleSet(lUIO, \"color\", \"grey\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
2 years ago
"metadata": {},
"outputs": [],
"source": [
"UIWeb.UIOAttributeStyleRemove(lUIO, \"color\")"
]
},
{
"cell_type": "code",
"execution_count": 10,
2 years ago
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'rgba(0, 91, 209, 1)'"
]
},
"execution_count": 10,
2 years ago
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"UIWeb.UIOAttributeStyleGet(lUIO, \"color\")"
]
},
{
"cell_type": "code",
"execution_count": 16,
2 years ago
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<selenium.webdriver.remote.webelement.WebElement (session=\"2d9c81f94cb903caaa62936fe795b5ba\", element=\"98e83708-c889-4d63-9f60-f21f31b19e0c\")>\n"
]
}
],
2 years ago
"source": [
"import time\n",
"UIWeb.UIOMouseSearchInit()\n",
"time.sleep(3)\n",
"print(UIWeb.UIOMouseSearchReturn())"
2 years ago
]
},
{
"cell_type": "code",
"execution_count": 18,
2 years ago
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Греция спустя 12 лет вышла из-под усиленного контроля кредиторов'"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
2 years ago
}
],
"source": [
"UIWeb.UIOTextGet(lUIO)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"UIWeb.UIOSelectorHighlight(lUIOSelectorStr)"
2 years ago
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
2 years ago
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
2 years ago
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 4
}