-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from dimagoltsman/master
Adding Hilan
- Loading branch information
Showing
4 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,8 @@ hbinov: | |
NAME: | ||
MOBILE: | ||
ID: | ||
SIG_FILE_NAME: | ||
SIG_FILE_NAME: | ||
hilan: | ||
URL: | ||
EMPLOYEE_NUM: | ||
PASSWORD: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
from selenium import webdriver | ||
from selenium.webdriver.chrome.options import Options | ||
from datetime import date, datetime | ||
import time, os | ||
from selenium.common.exceptions import InvalidSessionIdException | ||
from loguru import logger | ||
import helpers | ||
|
||
def sign(usr, passw, formUrl, Image): | ||
|
||
try: | ||
logger.info("Starting process") | ||
browser = helpers.GetBrowser() | ||
try: | ||
helpers.ping(browser, 'infogan') | ||
except: | ||
logger.debug('Unable to ping') | ||
|
||
browser.get(formUrl) | ||
helpers.log_browser(browser) | ||
#get needed elements | ||
employee_id = '//*[@id="user_nm"]' | ||
empoyee_pass = '//*[@id="password_nm"]' | ||
|
||
browser.find_element_by_xpath(employee_id).send_keys(usr) | ||
browser.find_element_by_xpath(empoyee_pass).send_keys(passw) | ||
|
||
#Login | ||
browser.find_element_by_xpath('//*[@type="submit"]').click() | ||
time.sleep(4) | ||
browser.find_element_by_xpath('//*[@for="chkApprove"]').click() | ||
browser.find_element_by_xpath('//*[@id="btnSubmit"]').click() | ||
|
||
helpers.log_browser(browser) | ||
helpers.fullpage_screenshot(browser,Image) | ||
|
||
return 1 | ||
except Exception as ex: | ||
logger.error(str(ex)) | ||
return 0 |