Created
April 8, 2020 00:24
-
-
Save noelje/9d47dae67e75a892e5685729f8592116 to your computer and use it in GitHub Desktop.
HiQ Chat is QUT's chat support. You have to enter your details before the chat gets initiated. This script uses Selenium to automate the input process and begins the chat.
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
import time | |
from selenium import webdriver | |
from selenium.webdriver.common.action_chains import ActionChains | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.chrome.options import Options | |
chrome_options = Options() | |
chrome_options.add_argument("--no-sandbox") | |
chrome_options.add_argument("--disable-setuid-sandbox") | |
driver = webdriver.Chrome('/path/to/chromedriver', chrome_options=chrome_options) # Optional argument, if not specified will search path. | |
driver.get('https://ask.qut.edu.au/app/chat/chat_launch'); | |
def slow_typing(element, text): | |
for character in text: | |
element.send_keys(character) | |
time.sleep(0.01) | |
firstname = driver.find_element_by_id('rn_TextInput_3_Contact.Name.First') | |
lastname = driver.find_element_by_id('rn_TextInput_5_Contact.Name.Last') | |
email = driver.find_element_by_id('rn_TextInput_7_Contact.Emails.PRIMARY.Address') | |
subjectmatter = driver.find_element_by_id('rn_TextInput_8_Incident.Subject') | |
login_button = driver.find_element_by_id('rn_ChatLaunchButton_10_Button') | |
slow_typing(firstname, 'FirstName') | |
slow_typing(lastname, 'LastName') | |
slow_typing(email, 'admin@admin.com') | |
slow_typing(subjectmatter, 'quick question') | |
login_button.click() | |
time.sleep(5) | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment