自動(dòng)化框架實(shí)操演示
1.添加頭像
1关斜、送貨 ---高級(jí)成員?
1. 使用任何用戶(hù)登錄并轉(zhuǎn)到高級(jí)會(huì)員
2. 右鍵單擊并檢查帶有Juice Shop 徽標(biāo)的送貨箱的圖像在塔。五個(gè)?assets/public/images/JuiceShop_Logo.png以不同的大小和位置加載到 SVG 圖形上。
3. main.js在瀏覽器中打開(kāi)DevTools 并搜索與該頁(yè)面和 SVG 圖像相關(guān)的相應(yīng) Angular 控制器代碼 ?搜索assets/public/images/JuiceShop_Logo.png
4. 前后找到application.logogetApplicationConfiguration()蒸痹,testDecal!開(kāi)發(fā)人員似乎使用它來(lái)測(cè)試 SVG 上的疊加圖像,但在上線之前忘記將其刪除蛔糯!啊窖式!
5. 嘗試該testDecal參數(shù)蚁飒,例如通過(guò)訪問(wèn)?http://localhost:3000/#/deluxe-membership?testDecal=test。您會(huì)注意到盒子上的徽標(biāo)現(xiàn)在已經(jīng)消失或顯示損壞的圖像符號(hào)萝喘。
思路:把png換了就 行淮逻。?
使用網(wǎng)上地址:搜索--查看圖片http://img.crcz.com/allimg/201911/26/1574765536225916.jpg?
換一個(gè)本地,網(wǎng)上不都行阁簸,估計(jì)是網(wǎng)站做限制爬早,有白名單。加了安全策略启妹。
1. 嘗試該testDecal參數(shù)筛严,例如通過(guò)訪問(wèn)?http://localhost:3000/#/deluxe-membership?testDecal=test。您會(huì)注意到盒子上的徽標(biāo)現(xiàn)在已經(jīng)消失或顯示損壞的圖像符號(hào)饶米。?
讓我們將您重定向到我們的加密貨幣地址之一?
重定向技術(shù)?
強(qiáng)制重定向到你不應(yīng)該重定向到的頁(yè)面?
1. 從導(dǎo)航欄中的GitHub按鈕中選擇應(yīng)用程序中的一個(gè)重定向鏈接桨啃,例如?http://114.116.97.187:8001/redirect?to=https://github.com/bkimminich/juice-shop2. http://114.116.97.187:8001/redirect?to=https://cn.bing.com報(bào)406 Error: Unrecognized target URL for redirect.3. http://114.116.97.187:8001/redirect/報(bào)500 TypeError: Cannot read property of undefined (reading ‘includes’) 白名單(isRedirectAllowed)4. 制作一個(gè)重定向 URL,以便目標(biāo) URLto帶有一個(gè)包含來(lái)自允許列表的 URL 的自己的參數(shù)檬输,例如http://114.116.97.187:8002/redirect?to=http://kimminich.de?pwned=https://github.com/bkimminich/juice-shop5. https://bkimminich.github.io/?pwned=https://github.com/bkimminich/juice-shop你們自己寫(xiě)一個(gè)從juiceshop網(wǎng)站跳轉(zhuǎn)到bing优幸,taobao的http://114.116.97.187:8002/redirect?to=https://uland.taobao.com/sem/tbsearch?refpid=https://github.com/bkimminich/juice-shop?
http://114.116.97.187:8002/r通過(guò)juiceshop網(wǎng)站加一 個(gè)鏈接,點(diǎn)擊直接進(jìn)入,taobaoedirect?to=https:
修改這個(gè)鏈接的值褪猛,點(diǎn)擊直接可以跳到?
//github.com/bkimminich/juice-shop?testDecal=../../../../redirect?to=https://placekitten.com/g/400/500?x=https://github.com/bkimminich/juice-shop?
?testDecal=../../../../redirect?to=https://placekitten.com/g/400/500?x=https://github.com/bkimminich/juice-shop
2.解決使用未正確關(guān)閉的棄用B2B接口太挑戰(zhàn)
上傳xml文件网杆。
https://pwning.owasp-juice.shop/appendi
代碼如下
# Author: lindafang# Date: 7/28/22 11:44 AM# File: page_bing.pyfrom selenium.webdriver.common.by import Byfrom .base_action import BaseAction# 瀏覽器bing搜索頁(yè) 中也要 有 公共的方法可 用class BingSearchPage(BaseAction):# 屬性,元素,元素定位,如果定位換了碳却,只換這里就行了队秩,其他代碼不用改search_text=By.ID,"sb_form_q"search_click=By.ID,"search_icon"# 方法 在搜索框中輸入信息,def enter_keyword(self,text):self.input(self.search_text,text)# 方法 點(diǎn)擊搜索圖標(biāo)def click_search(self):self.click(self.search_click)# 瀏覽器bing搜索結(jié)果頁(yè)class SearchResultPage(BaseAction):# 沒(méi)什么屬性# 方法:返回要 驗(yàn)證元素文本def get_source(self):return self.driver.page_source?
x/solutions.html# Author: lindafang
# Date: 7/28/22 2:21 PM
# File: test_bing.py
import pytest
import allure
from selenium import webdriver
from .page_bing import BingSearchPage, SearchResultPage
初始化測(cè)試步驟
# 測(cè)試步驟:
# 初始化:
# 打開(kāi)瀏覽器,關(guān)閉 瀏覽器
@pytest.fixture(scope="module")
def driver():
driver = webdriver.Chrome("/Users/lindafang/PycharmProjects/selenium_project0704/driver/chromedriver")
driver.implicitly_wait(30)
yield driver
driver.close()
def test_bing_soso(driver):
# ???輸入bing地址
driver.get("https://cn.bing.com")
# ?初始化bing搜索 頁(yè)
bing_search = BingSearchPage(driver)
# 在搜索框輸入關(guān)鍵 字
bing_search.enter_keyword("selenium")
# 點(diǎn)擊搜索
bing_search.click_search()
# 初始化結(jié)果頁(yè)
result_page = SearchResultPage(driver)
# 斷言搜索結(jié)果正確
assert "selenium" in result_page.get_source()# Author: lindafang
# Date: 7/28/22 2:21 PM
# File: test_bing.py
import pytest
import allure
from selenium import webdriver
from .page_bing import BingSearchPage, SearchResultPage
# 測(cè)試步驟:
# 初始化:
# 打開(kāi)瀏覽器,關(guān)閉 瀏覽器(范圍 :module,一個(gè)文件只執(zhí)行一次)
@pytest.fixture(scope="module")
def driver():
driver = webdriver.Chrome("/Users/lindafang/PycharmProjects/selenium_project0704/driver/chromedriver")
driver.implicitly_wait(30)
# 執(zhí)行第 一次 返回driver昼浦,當(dāng)測(cè)試方法執(zhí)行完成后再進(jìn)入時(shí)從這句開(kāi)始執(zhí)行馍资,直接執(zhí)行關(guān)閉瀏覽器
yield driver
driver.close()
修改參數(shù):
def test_bing_soso(driver):
# 參數(shù)driver是上面的方法名,通過(guò)傳參的方式关噪,在測(cè)試方法 前調(diào)用鸟蟹。
# ???輸入bing地址
driver.get("https://cn.bing.com")
# ?初始化bing搜索 頁(yè)
bing_search = BingSearchPage(driver)
# 在搜索框輸入關(guān)鍵 字
bing_search.enter_keyword("selenium")
# 點(diǎn)擊搜索
bing_search.click_search()
# 初始化結(jié)果頁(yè)
result_page = SearchResultPage(driver)
# 斷言搜索結(jié)果正確
assert "selenium" in result_page.get_source()
如圖所示:
wait = WebDriverWait(driver, timeout=10, poll_frequency=1, ignored_exceptions=[ElementNotVisibleException, ElementNotSelectableException])element = wait.until(EC.element_to_be_clickable((By.XPATH, "http://div")))
from selenium.webdriver.support ?import expected_conditions as ?EC
# 瀏覽器bing搜索結(jié)果頁(yè)
class SearchResultPage(BaseAction):
# ????沒(méi)什么屬性
# ?????方法:返回要 驗(yàn)證元素文本
def get_source(self,txt):
wait = WebDriverWait(self.driver, 10, 1)
element = wait.until(EC.visibility_of_element_located((By.PARTIAL_LINK_TEXT,txt)))
return element.text