自動化框架實操演示
1.添加頭像
1、送貨 ---高級成員?
1. 使用任何用戶登錄并轉(zhuǎn)到高級會員
2. 右鍵單擊并檢查帶有Juice Shop 徽標(biāo)的送貨箱的圖像。五個?assets/public/images/JuiceShop_Logo.png以不同的大小和位置加載到 SVG 圖形上。
3. main.js在瀏覽器中打開DevTools 并搜索與該頁面和 SVG 圖像相關(guān)的相應(yīng) Angular 控制器代碼 ?搜索assets/public/images/JuiceShop_Logo.png
4. 前后找到application.logogetApplicationConfiguration(),testDecal!開發(fā)人員似乎使用它來測試 SVG 上的疊加圖像,但在上線之前忘記將其刪除!??!
5. 嘗試該testDecal參數(shù),例如通過訪問?http://localhost:3000/#/deluxe-membership?testDecal=test。您會注意到盒子上的徽標(biāo)現(xiàn)在已經(jīng)消失或顯示損壞的圖像符號。
思路:把png換了就 行。?
使用網(wǎng)上地址:搜索--查看圖片http://img.crcz.com/allimg/201911/26/1574765536225916.jpg?
換一個本地,網(wǎng)上不都行,估計是網(wǎng)站做限制,有白名單。加了安全策略。
1. 嘗試該testDecal參數(shù),例如通過訪問?http://localhost:3000/#/deluxe-membership?testDecal=test。您會注意到盒子上的徽標(biāo)現(xiàn)在已經(jīng)消失或顯示損壞的圖像符號。?
讓我們將您重定向到我們的加密貨幣地址之一?
重定向技術(shù)?
強制重定向到你不應(yīng)該重定向到的頁面?
1. 從導(dǎo)航欄中的GitHub按鈕中選擇應(yīng)用程序中的一個重定向鏈接,例如?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報406 Error: Unrecognized target URL for redirect.3. http://114.116.97.187:8001/redirect/報500 TypeError: Cannot read property of undefined (reading ‘includes’) 白名單(isRedirectAllowed)4. 制作一個重定向 URL,以便目標(biāo) URLto帶有一個包含來自允許列表的 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你們自己寫一個從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通過juiceshop網(wǎng)站加一 個鏈接,點擊直接進(jìn)入,taobaoedirect?to=https:
修改這個鏈接的值,點擊直接可以跳到?
//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搜索頁 中也要 有 公共的方法可 用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)# 方法 點擊搜索圖標(biāo)def click_search(self):self.click(self.search_click)# 瀏覽器bing搜索結(jié)果頁class SearchResultPage(BaseAction):# 沒什么屬性# 方法:返回要 驗證元素文本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
初始化測試步驟
# 測試步驟:
# 初始化:
# 打開瀏覽器,關(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搜索 頁
bing_search = BingSearchPage(driver)
# 在搜索框輸入關(guān)鍵 字
bing_search.enter_keyword("selenium")
# 點擊搜索
bing_search.click_search()
# 初始化結(jié)果頁
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
# 測試步驟:
# 初始化:
# 打開瀏覽器,關(guān)閉 瀏覽器(范圍 :module,一個文件只執(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)測試方法執(zhí)行完成后再進(jìn)入時從這句開始執(zhí)行,直接執(zhí)行關(guān)閉瀏覽器
yield driver
driver.close()
修改參數(shù):
def test_bing_soso(driver):
# 參數(shù)driver是上面的方法名,通過傳參的方式,在測試方法 前調(diào)用。
# ???輸入bing地址
driver.get("https://cn.bing.com")
# ?初始化bing搜索 頁
bing_search = BingSearchPage(driver)
# 在搜索框輸入關(guān)鍵 字
bing_search.enter_keyword("selenium")
# 點擊搜索
bing_search.click_search()
# 初始化結(jié)果頁
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é)果頁
class SearchResultPage(BaseAction):
# ????沒什么屬性
# ?????方法:返回要 驗證元素文本
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