Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
scrapper-portabilidad
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Javier
scrapper-portabilidad
Commits
548a2151
Commit
548a2151
authored
Dec 22, 2021
by
Javier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tarifa
parent
31c75d8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
+34
-3
magnusbillingse.py
notebook/magnusbillingse.py
+34
-3
No files found.
notebook/magnusbillingse.py
View file @
548a2151
...
@@ -5,6 +5,9 @@ from selenium.webdriver.support import expected_conditions as EC
...
@@ -5,6 +5,9 @@ from selenium.webdriver.support import expected_conditions as EC
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.by
import
By
from
selenium.common.exceptions
import
TimeoutException
from
selenium.common.exceptions
import
TimeoutException
from
selenium.webdriver.common.keys
import
Keys
from
selenium.webdriver.common.keys
import
Keys
from
selenium.webdriver.common.action_chains
import
ActionChains
from
enum
import
Enum
import
time
import
time
magnus
=
"http://192.168.2.56/mbilling/"
magnus
=
"http://192.168.2.56/mbilling/"
...
@@ -13,18 +16,46 @@ login = {
...
@@ -13,18 +16,46 @@ login = {
'password'
:
'NgtAtONgeRaFtsbu'
,
'password'
:
'NgtAtONgeRaFtsbu'
,
}
}
class
Tarifa
(
Enum
):
ESTANDAR
=
'Tarifa Estándar'
EMPRESA
=
'Tarifa Empresas'
PLANA1000
=
'Bono PTV'
PLANA2000
=
'Bono PTV'
def
authenticate
(
driver
:
webdriver
.
Firefox
):
def
authenticate
(
driver
:
webdriver
.
Firefox
):
driver
.
get
(
magnus
)
driver
.
get
(
magnus
)
WebDriverWait
(
driver
,
3
)
.
until
(
EC
.
element_to_be_clickable
((
By
.
XPATH
,
'//*[@id="textfield-1013-inputEl"]'
)))
.
send_keys
(
login
[
'user'
])
WebDriverWait
(
driver
,
3
)
.
until
(
EC
.
element_to_be_clickable
((
By
.
XPATH
,
'//*[@id="textfield-1013-inputEl"]'
)))
.
send_keys
(
login
[
'user'
])
driver
.
find_element
(
By
.
XPATH
,
'//*[@id="textfield-1014-inputEl"]'
)
.
send_keys
(
login
[
'password'
],
Keys
.
ENTER
)
driver
.
find_element
(
By
.
XPATH
,
'//*[@id="textfield-1014-inputEl"]'
)
.
send_keys
(
login
[
'password'
],
Keys
.
ENTER
)
def
add_new_user
(
driver
:
webdriver
.
Firefox
,
telefono
:
str
):
try
:
WebDriverWait
(
driver
,
5
)
.
until
(
EC
.
element_to_be_clickable
((
By
.
XPATH
,
' //*[@id="tool-1031-toolEl"]'
)))
.
click
()
except
TimeoutException
:
pass
def
add_new_user
(
driver
:
webdriver
.
Firefox
,
telefono
:
str
,
tarifa
:
Tarifa
=
Tarifa
.
ESTANDAR
):
# Acceso a Panel
# Acceso a Panel
WebDriverWait
(
driver
,
3
)
.
until
(
EC
.
element_to_be_clickable
((
By
.
XPATH
,
'//*[@id="treeview-1176-record-10"]'
)))
.
click
()
WebDriverWait
(
driver
,
3
)
.
until
(
EC
.
element_to_be_clickable
((
By
.
XPATH
,
'//*[@id="treeview-1176-record-10"]'
)))
.
click
()
WebDriverWait
(
driver
,
3
)
.
until
(
EC
.
element_to_be_clickable
((
By
.
XPATH
,
'//*[@id="button-1270"]'
)))
.
click
()
WebDriverWait
(
driver
,
3
)
.
until
(
EC
.
element_to_be_clickable
((
By
.
XPATH
,
'//*[@id="button-1270"]'
)))
.
click
()
WebDriverWait
(
driver
,
3
)
.
until
(
EC
.
element_to_be_clickable
((
By
.
XPATH
,
'//*[@id="textfield-1291-inputEl"]'
)))
.
clear
()
.
send_keys
(
telefono
)
# Usuario
username
=
WebDriverWait
(
driver
,
3
)
.
until
(
EC
.
element_to_be_clickable
((
By
.
XPATH
,
'//*[@id="textfield-1291-inputEl"]'
)))
username
.
clear
()
username
.
send_keys
(
telefono
)
driver
.
find_element
(
By
.
XPATH
,
'//*[@id="groupusercombo-1293-trigger-picker"]'
)
.
click
()
driver
.
find_element
(
By
.
XPATH
,
'//ul[@data-ref="listEl"]/li[text()="Cliente"]'
)
.
click
()
# Tarifa
driver
.
find_element
(
By
.
XPATH
,
'//*[@id="button-1297"]'
)
.
click
()
tarifa
=
WebDriverWait
(
driver
,
3
)
.
until
(
EC
.
element_to_be_clickable
(
(
By
.
XPATH
,
f
'//*[contains(@id,"tableview")]//table//div[text()="{tarifa.value}"]'
))
)
ActionChains
(
driver
)
.
double_click
(
tarifa
)
.
perform
()
driver
.
find_element
(
By
.
XPATH
,
'//*[@id="button-1403"]'
)
.
click
()
# Datos Personales
driver
.
find_element
(
By
.
XPATH
,
'//*[@id="tab-1357-btnInnerEl"]'
)
.
click
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
options
=
FirefoxOptions
()
options
=
FirefoxOptions
()
#options.add_argument("--headless")
#options.add_argument("--headless")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment