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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"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",
"from pyOpenRPA.Robot import UIWeb\n",
"UIWeb.BrowserChromeStart()\n",
"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",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"UIWeb.BrowserClose()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
" # 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!\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"UIWeb.UIOAttributeSet(lUIO,\"test\", \"asd\")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"UIWeb.UIOAttributeRemove(lUIO, \"test\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"UIWeb.UIOAttributeStyleSet(lUIO, \"color\", \"grey\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"UIWeb.UIOAttributeStyleRemove(lUIO, \"color\")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'rgba(0, 91, 209, 1)'"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"UIWeb.UIOAttributeStyleGet(lUIO, \"color\")"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<selenium.webdriver.remote.webelement.WebElement (session=\"2d9c81f94cb903caaa62936fe795b5ba\", element=\"98e83708-c889-4d63-9f60-f21f31b19e0c\")>\n"
]
}
],
"source": [
"import time\n",
"UIWeb.UIOMouseSearchInit()\n",
"time.sleep(3)\n",
"print(UIWeb.UIOMouseSearchReturn())"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Греция спустя 12 лет вышла из-под усиленного контроля кредиторов'"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"UIWeb.UIOTextGet(lUIO)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"UIWeb.UIOSelectorHighlight(lUIOSelectorStr)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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"
},
"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
}