2022-07-30

自動化框架實操演示

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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 自動化測試實操步驟 第一關(guān):在搜索輸入文檔框中輸入 ,只要有彈出框就是有漏洞 第二關(guān):使用網(wǎng)易云音樂,生成外鍵播放...
    com_bc0b閱讀 374評論 0 0
  • 我已都闖關(guān)通過,把我自己闖關(guān)步驟和截圖提供給大家,自學(xué)能力強的可自行解決,并且從中提升安全滲透測試能力。如果需要具...
    測試星云閱讀 792評論 0 1
  • 1. link元素 ? link元素是外部資源鏈接元素,規(guī)范了文檔與外部資源的關(guān)系? link元素通常是在head...
    未路過閱讀 578評論 0 0
  • # Awesome Python [![Awesome](https://cdn.rawgit.com/sindr...
    emily_007閱讀 2,336評論 0 3
  • 程序員必須知道的網(wǎng)站:https://www.cxy521.com/ ailogo在線生成工具:https://a...
    c00e37e364ad閱讀 18評論 0 0

友情鏈接更多精彩內(nèi)容