2023年3月26日 星期日

如何自動賺Rewards點數 - 用firefox套件 Selenium IDE

 用FireFox的Selenium IDE來寫自動測試,可在bing搜尋頁面輸入隨機5碼數字,並按下搜尋,這樣的動作要執行35次


以下是使用 Selenium IDE 寫自動測試的步驟:


打開 Selenium IDE。

在左側的 "Test Suites" 面板中點擊 "+ New Test Suite",並為測試套件命名。

在 "Test Cases" 面板中點擊 "+ New Test Case",並為測試用例命名。

在 "Commands" 面板中點擊 "+ Add Command"。

在彈出的命令列表中,選擇 "open",並在 "Target" 欄位中輸入 "https://www.bing.com/",然後點擊 "Add" 按鈕。

再次點擊 "+ Add Command"。

選擇 "type",並在 "Target" 欄位中輸入 "id=sb_form_q",在 "Value" 欄位中輸入一個隨機的 5 位數字(可以使用 JavaScript 生成),然後點擊 "Add" 按鈕。

再次點擊 "+ Add Command"。

選擇 "click",並在 "Target" 欄位中輸入 "id=sb_form_go",然後點擊 "Add" 按鈕。

複製步驟 7 到步驟 9,並將其插入到測試用例中,以模擬在 Bing 搜尋頁面上輸入另一個隨機 5 位數字的動作。

在 Selenium IDE 工具欄中點擊 "Run" 按鈕,以運行測試。

下面是相應的 Selenium IDE 測試腳本:


{

  "id": "f116f9c6-40b1-413a-ba0f-182bd3501gpt",

  "version": "2.0",

  "name": "Bing Search Test from GPT",

  "url": "https://www.bing.com",

  "tests": [

    {

      "id": "Test Case",

      "name": "Search for Random 5-Digit Number Twice",

      "commands": [

        {

          "command": "open",

          "target": "/search?q=AI",

          "value": ""

        },  

        {

          "command": "execute script",

          "target": "return 1;",

          "value": "index"

        },

        {

          "command": "while",

          "target": "${index} < 35 + 1",

          "value": ""

        },

        {

          "command": "execute script",

          "target": "return Math.floor(Math.random() * 90000) + 10000;",

          "value": "searchTerm"

        },

        {

          "command": "type",

          "target": "id=sb_form_q",

          "value": "${index}${searchTerm}"

        },

        {

          "command": "click",

          "target": "id=sb_form_go",

          "value": ""

        },

{

  "command": "pause",

  "target": "2800",

  "value": ""

},

        {

          "command": "execute script",

          "target": "return ${index} + 1;",

          "value": "index"

        },

        {

          "command": "end",

          "target": "",

          "value": ""

        }

      ]

    }

  ]

}







注意:在這個腳本中,我們使用了 JavaScript 的 Math.random() 函数來生成隨機的5 位數字。這個函數生成一個 0 到 1 之間的隨機小數,然後我們將其乘以 90000,再加上 10000,這樣就能生成一個 10000 到 99999 之間的隨機整數了。


此外,這個腳本中還使用了 Selenium IDE 的基本命令 open、type 和 click,這些命令可以模擬網頁上的基本操作,比如打開頁面、輸入文字和點擊按鈕等。


最後,我們可以運行這個腳本,讓 Selenium IDE 自動打開 Bing 搜尋頁面,輸入隨機的 5 位數字,然後點擊搜尋按鈕,這樣的動作會被執行35次,並且每次都會使用不同的隨機數字進行搜索。




=============================



您可以使用Firefox的User-Agent Switcher and Manager擴充套件來切換不同的User-Agent。這個擴充套件能夠修改HTTP傳輸協定的請求標頭(request header)字串值(如:瀏覽器排版引擎、作業系統版本),以達到瀏覽網頁時能進行偽裝切換(如只有透過手機瀏覽才能顯示手機專用的網頁版本)。

在Firefox的擴充套件商店中下載安裝User-Agent Switcher and Manager,安裝完成後,在工具列點開圖示,即可任意切換不同系統的瀏覽器,查看網頁在不同平台裝置上所支援的顯示。


使用User-Agent Switcher and Manager的方法很簡單。首先,在瀏覽器右上方點擊「 」圖示即可點開User-Agent Switcher and Manager操作介面。

在介面中,您可以選擇瀏覽器版本和作業系統版本,最後選擇瀏覽器編號版本,點選完畢後可點擊「Apply (Active window)」(只套用當前作用中所開啟的網站分頁)或「Apply (all windows)」(套用所有開啟的網站分頁)按鈕進行設定套用。

2023年2月23日 星期四

[筆記] mio 5051 如何產製KML檔

 


用Google的 my map建置好地圖,接著再匯出成KML

https://www.google.com/maps/d/?hl=zh-TW






打開KML檔,把 <Document> 這層節點拿掉







 

MangoHost Copyright © 2009 Cookiez is Designed by Ipietoon for Free Blogger Template