如何在PowerShell 5.1中设置别名头部和尾部

时间:2019-07-15 20:15:27

标签: powershell-5.0

我需要了解PowerShell 5.1中的HOWTO别名

这些都太痛苦了:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.action_chains import ActionChains
import time

#### location of chrome 
driver = webdriver.Chrome(r'F:\User\Downloads\chromedriver.exe')

#### log in website 1
driver.get('https://www.yardipca.com/39444siteminderlive/')

### 1st door ( login& password)
name_1st = driver.find_element_by_name('USER')
name_1st.clear()
name_1st.send_keys('my_account')

passowrd_1st = driver.find_element_by_name('PASSWORD')
passowrd_1st.clear()
passowrd_1st.send_keys('my_password')

### login botton
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH,"/html/body/form/div/center/table[2]/tbody/tr[3]/td[2]/table/tbody/tr[8]/td[2]/input[6]"))).click()
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.LINK_TEXT,"P260 Live System (SAN/HOC)"))).click()
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="acceptButton"]'))).click()

time.sleep(10)




#### log in website 2
driver.get('https://www.yardiasptx11.com/39444p260livehoc/jsp/index.jsp')

### 2nd door ( login& password)
name_2nd = driver.find_element_by_name('userId')
name_2nd.send_keys('my_account')

passowrd_2nd = driver.find_element_by_name('password')
passowrd_2nd.send_keys('my_password')

### login botton
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, '//[@id="standardLoginForm"]/div[3]/button'))).click()
time.sleep(5)

### Dropdown button
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="widget_937242"]/div[1]/div[1]'))).click()

# //*[@id="widget_937242"]/div[1]/div[1]
# //*[@id="widget_937242"]/div[1]/div[1]/a
# //*[@id="widget_937242"]/div[1]/div[1]/a/span

### download file
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.CSS_SELECTOR,'#widget_937242 > div.panel-heading.ui-sortable-handle > div.btn-group.pull-right.print-hide.open > ul > li:nth-child(2) > a'))).click()



time.sleep(10)

我想在PowerShell 5.1中为别名使用“别名”

0 个答案:

没有答案