Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import Select
- from selenium.common.exceptions import NoSuchElementException
- from selenium.common.exceptions import TimeoutException
- import selenium.webdriver.support.ui as UI
- from selenium.webdriver.support import expected_conditions as EC
- import time
- "Use random var for the interval between clicks"
- "Identify authorization credentials "
- baseurl = "myUrl"
- username = "myUser"
- password = "myPass
- xpaths = {'usernameTxtBox': "//*[@id='Username']",
- 'passwordTxtBox': "//*[@id='Pass']",
- 'submitButton': "//*[@id='LogIn']",
- 'DashboardTableButton': "//*[@id='DashboardTable"
- }
- mydriver = webdriver.Chrome(
- executable_path='AppData\Local\Programs\Python\Python36-32\Scripts\chromedriver.exe')
- mydriver.get(baseurl)
- mydriver.maximize_window()
- "Write Username"
- mydriver.find_element_by_xpath(xpaths['usernameTxtBox']).send_keys(username)
- "Clear Password TextBox"
- mydriver.find_element_by_xpath(xpaths['passwordTxtBox']).clear()
- "Write Password"
- mydriver.find_element_by_xpath(xpaths['passwordTxtBox']).send_keys(password)
- "Click Login Button"
- mydriver.find_element_by_xpath(xpaths['submitButton']).click()
- "Wait to click"
- mydriver.implicitly_wait(4)
- "Click Button that leads to Dashboard"
- mydriver.find_element_by_xpath(xpaths['DashboardTableButton']).click()
- "It is HERE where I am conceptually stuck"
- mydriver.implicitly_wait(6)
- list_of_links = mydriver.find_elements_by_tag_name('h4') # Identify all the Links in the DashboardTable (there are 10 in each page)
- for links in enumerate(list_of_links) :
- mydriver.implicitly_wait(4)
- for link in enumerate(links):
- link.click()
- "Filter data"
- mydriver.find_element_by_xpath('//*[@id="status-wrapper"]/div/ul/li[3]/button').click()
- mydriver.find_element_by_xpath('//*[@id="header-bar-project-table"]/dt[1]/button').click()
- mydriver.find_element_by_xpath('//*[@id="filter-modal-content"]/li[1]/ul/li[2]/fieldset/h4/legend/button').click
- mydriver.find_element_by_xpath('//*[@id="search-facet-input-excludeActivities-true"]').click
- mydriver.find_element_by_xpath('//*[@id="search-facet-input-activityType-E"]').click
- mydriver.find_element_by_xpath('//*[@id="activityTimespan"]').click
- mydriver.find_element_by_xpath('//*[@id="activityTimespan"]/option[5]').click
- mydriver.find_element_by_xpath('//*[@id="dialog"]/div/div[2]/div/p/button[1]').click
- "Save As"
- mydriver.find_element_by_xpath('//*[@id="all-checkbox"]').click
- mydriver.find_element_by_xpath('//*[@id="bulk-actions-bar"]/li[7]/button').click()
- mydriver.implicitly_wait(6)
- mydriver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement