自动填写表单程序2

这篇博客介绍了如何为公园信息添加Note或Alert,并在完成操作后如何分配Sites。内容包括利用改变每页显示数量进行翻页、通过字体样式强调打印信息,以及处理难以定位的页面元素的方法。
摘要由CSDN通过智能技术生成

为公园添加Note/Alert信息:
Note and Alert Page
添加了Note或者Alert后点击APPLY将会出现Sites标签,点进去为它分配sites。
After adding Note/Alert, still need to assign sites for this note or alert.
下面是未封装的实现代码:

from selenium import webdriver
import time
import xlrd
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select

""""""
url = 'https://reserveamerica.com/xxx'
account_user = 'xxx'
account_password = 'xxx'
wb = xlrd.open_workbook('D://AddNotesandAlerts.xls')
""""""
sheet1 = wb.sheet_by_index(0)
contract = sheet1.col_values(0)[1].strip()
park_name = sheet1.col_values(1)[1].strip()
type_name = sheet1.col_values(2)
error = ''
# Open firefox browser with addons and go to Orms page
driver = webdriver.Firefox(executable_path='D:\Selenium 3.14\geckodriver.exe', timeout=5)
driver.delete_all_cookies()
driver.get(url)
driver.maximize_window()
time.sleep(2)

# Input user name on login page
user_name_element = driver.find_element_by_id('userName')
user_name_element.clear()
user_name_element.send_keys(account_user)

# Input password on login page
user_password_element = driver.find_element_by_id('password')
user_password_element.clear()
user_password_element.send_keys(account_password)

# Login
ok_button = driver.find_element_by_id('okBtnAnchor')
ok_button.click()
time.sleep(2)

# Choose contract
contract_option = driver.find_element_by_xpath("//option[text()='" + contract + " Contract']")
contract_option.click()
time.sleep(2)

# Go to Inventory Manager page
finance_manager = dr
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值