全网最细致地讲解Spring Security、Spring Social 、Spring Security OAuth三种技术开发安全的REST服务,彻底掌握一线互联网公司主流的身份认证和授权方式。
适合人群及技术储备要求
本课程适合有一定的开发经验,想要深入了解认证和授权相关知识的Java开发人员
如果你对设计模式,设计思想感兴趣,这门课对你来说会有很大帮助
学前必备技术
JavaWeb基础丨Spring基础丨Maven基础
import time
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.maximize_window()
driver.get("http://www.baidu.com")
ac = ActionChains(driver)
第二步:定位要操作的元素ele = driver.find_element_by_xpath('//span[@id="s-usersetting-top"]')
第三步:执行对应的操作ac.move_to_element(ele) # 悬浮操作
第四步,释放鼠标动作ac.perform()
点击悬停出来的页面上的元素wait = WebDriverWait(driver, 10)
loc = (By.XPATH, '//a[@class="setpref"]')
wait.until(EC.visibility_of_element_located(loc))
driver.find_element(*loc).click()
time.sleep(2)
driver.quit()
def move_to():
print("正在挪动")
def click():
print('点击')
actions = []
actions.append(move_to)
actions.append(click)
for action in actions: # perform
action()
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.maximize_window()
driver.get("http://www.baidu.com")
driver.find_element_by_id('kw').send_keys("selenium") # 没有点击百度一下也没有回车不会呈现搜索结果
time.sleep(2)
driver.find_element_by_id('kw').send_keys(Keys.CONTROL,'a') # 全选然后输入新内容python
driver.find_element_by_id('kw').send_keys('python', Keys.ENTER) # 用回车替代点击搜索按钮
time.sleep(2)
time.sleep(2)
driver.quit()
<html>
<head>
<meta charset="UTF-8">
<title>下拉框演示</title>
</head>
<body>
<select id="province">
<option value="sj">深圳</option>
<option value="gd">广东</option>
<option value="sh">上海</option>
<option value="bj">北京</option>
</select>
<select id="city">
<option value="sj">深圳</option>
<option value="gz">广州</option>
<option value="sh">上海</option>
<option value="bj">北京</option>
</select>
</body>
</html>
演示代码如下:
import time
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import Select
driver = webdriver.Chrome()
driver.maximize_window()
driver.get(r"D:\learn\test.html")
wait = WebDriverWait(driver, 10)
ele = driver.find_element_by_id('province')
实例化Select类s = Select(ele)
time.sleep(1)
s.select_by_value('gd') # 经过value属性选值
time.sleep(2)
s.select_by_index(2) # 经过下标index选值
time.sleep(2)
s.select_by_visible_text('北京') # 经过文本内容选值
time.sleep(2)
driver.quit()
import time
import datetime
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.maximize_window()driver.get("https://www.12306.cn/")
wait = WebDriverWait(driver, 30)
loc = (By.XPATH, '//input[@id="train_date"]')
wait.until(EC.visibility_of_element_located(loc))
js = 'document.getElementById("train_date").readOnly=false;'
driver.execute_script(js)
time.sleep(2)
driver.find_element(*loc).clear()
today = datetime.date.today()
tomorrow = today + datetime.timedelta(days=1)
driver.find_element_by_id('train_date').send_keys(str(tomorrow))
time.sleep(2)
driver.quit()