-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation for the Code
This is the documentation for the Main.py
script.
- selenium.webdriver.support (imported as
EC
) - webdriver_manager.chrome (imported as
ChromeDriverManager
) - selenium.webdriver.support.ui (imported as
WebDriverWait
andSelect
) - selenium.webdriver.chrome.options (imported as
Options
) - selenium.webdriver.chrome.service (imported as
Service
) - selenium.webdriver (imported as
ActionChains
) - selenium.webdriver.common.by (imported as
By
) - email.mime.multipart (imported as
MIMEMultipart
) - email.mime.text (imported as
MIMEText
) - selenium (imported as
webdriver
) - datetime (imported as
datetime
anddate
) - configparser (imported as
configparser
) - smtplib (imported as
smtplib
) - sys
- csv
- os
-
config
: An instance ofConfigParser
class. -
errorNotFound
: A string variable holding the value "Not found!". -
exceptionNoInputElements
: A string variable holding the value "No input elements found!". -
exceptionNoArgsProvided
: A string variable holding the value "No args provided!". -
salden
: A string variable holding the value "salden". -
logout
: A string variable holding the value "out". -
login
: A string variable holding the value "in".
Waits until the specified element is visible on the page.
-
by
: (Optional) The locator strategy. Defaults toBy.ID
. -
element
: (Optional) The element to wait for. Defaults to an empty string.
Returns the visible element.
Waits until all the specified elements are visible on the page.
-
by
: (Optional) The locator strategy. Defaults toBy.ID
. -
elements
: (Optional) The elements to wait for. Defaults to an empty string.
Returns a list of visible elements.
Connects to the webpage using Chrome WebDriver.
Switches the WebDriver's focus to an iframe.
Sets the input elements on the page.
Inserts the account number into the first input element.
Inserts the password into the second input element.
Sets the select elements on the page.
Sets the booking type based on the command-line argument.
Sets the booking type in the select element.
Sets the button elements on the page.
Clicks the "Salden" button.
Clicks the accept button.
Gets the booked time from the page.
Gets the label name for flex time from the page.
Gets the flex time from the page.
Gets the label name for vacation days from the page.
Gets the vacation days from the page.
Gets the label name for old vacation days from the page.
Gets the old vacation days from the page.
Checks if the log file exists.
Returns True
if the file exists, otherwise False
.
Stores the time information to a CSV file.
Quits the WebDriver.
Sends an email with the specified subject and body.
-
subject
: The subject of the email. -
body
: The body of the email.
The main execution of the script.
- Parses the command-line arguments.
- Connects to the webpage.
- Switches to the iframe.
- Sets the input elements.
- Inserts the account number.
- Inserts the password.
- Sets the select elements.
- Sets the booking type from the command-line argument.
- Sets the booking type in the select element.
- Sets the button elements.
- Performs the appropriate action based on the command-line argument (e.g., click "Salden" button or accept button).
- Gets the booked time.
- Prints the booked time.
- Stores the time information to the CSV file (if enabled).
- Sends an email with the time information (if enabled).
- Quits the WebDriver.
- Exits the script.