第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

硒 - 如何確認(rèn)具有兩個(gè)數(shù)字的驗(yàn)證碼在提交后更改

硒 - 如何確認(rèn)具有兩個(gè)數(shù)字的驗(yàn)證碼在提交后更改

藍(lán)山帝景 2022-08-03 15:13:15
我試圖找到有關(guān)我的問題的任何幫助,但沒有成功。我需要確認(rèn)驗(yàn)證碼(兩個(gè)數(shù)字)在無(wú)效提交后被更改??缍葮?biāo)記中有兩個(gè)數(shù)字(您可以打開此 URL 并查看 https://www.ultimateqa.com/filling-out-forms/)。步驟:開放式 https://www.ultimateqa.com/filling-out-forms/填寫右側(cè)的表單,但故意輸入 -1 作為添加的結(jié)果提交表單并確認(rèn)號(hào)碼已更改我解決了前兩個(gè)步驟,但我阻止了第3個(gè)步驟。有人可以幫我解決這個(gè)問題嗎?package zadaci;import org.openqa.selenium.By;import org.openqa.selenium.WebDriver;import org.openqa.selenium.chrome.ChromeDriver;public class zadatak1 {    public static void main(String[] args) {        // TODO Auto-generated method stubSystem.setProperty("webdriver.chrome.driver", "D:\\DriversSelenium\\chromedriver.exe");        WebDriver driver=new ChromeDriver();        driver.get("https://www.ultimateqa.com/filling-out-forms/");        driver.manage().window().maximize();        driver.findElement(By.xpath("//*[@id=\"et_pb_contact_name_1\"]")).sendKeys("TestName");        driver.findElement(By.xpath("//*[@id=\"et_pb_contact_message_1\"]")).sendKeys("TestMessage");        driver.findElement(By.xpath("/html/body/div[1]/div/div/article/div/div[1]/div/div/div/div[2]/div/div[2]/form/div/div/p/input")).sendKeys("-1");        driver.findElement(By.xpath("/html/body/div[1]/div/div/article/div/div[1]/div/div/div/div[2]/div/div[2]/form/div/button")).click();        driver.findElement(By.xpath("/html/body/div[1]/div/div/article/div/div[1]/div/div/div/div[2]/div/div[2]/form/div/div/p/span")).getText();        driver.close();            System.out.println("Test script executed successfully.");    }}提前致謝。:)
查看完整描述

2 回答

?
蠱毒傳說(shuō)

TA貢獻(xiàn)1895條經(jīng)驗(yàn) 獲得超3個(gè)贊

以下是在單擊“提交”之前和單擊“提交”之后必須使用的代碼行。然后比較它們不匹配。

driver.findElement(By.xpath("//span[@class='et_pb_contact_captcha_question']")).getText();


查看完整回答
反對(duì) 回復(fù) 2022-08-03
?
桃花長(zhǎng)相依

TA貢獻(xiàn)1860條經(jīng)驗(yàn) 獲得超8個(gè)贊

我在上面添加了這個(gè)代碼,并添加了比較方法。你能不能看看這沒問題?


package zadaci;


import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;


public class zadatak1 {


    public static void main(String[] args) {

        // TODO Auto-generated method stub


System.setProperty("webdriver.chrome.driver", "D:\\DriversSelenium\\chromedriver.exe");


        WebDriver driver=new ChromeDriver();


        driver.get("https://www.ultimateqa.com/filling-out-forms/");


        driver.manage().window().maximize();


        driver.findElement(By.xpath("//*[@id=\"et_pb_contact_name_1\"]")).sendKeys("TestName");


        driver.findElement(By.xpath("//*[@id=\"et_pb_contact_message_1\"]")).sendKeys("TestMessage");


        driver.findElement(By.xpath("/html/body/div[1]/div/div/article/div/div[1]/div/div/div/div[2]/div/div[2]/form/div/div/p/input")).sendKeys("-1");


        driver.findElement(By.xpath("//span[@class='et_pb_contact_captcha_question']")).getText();


        driver.findElement(By.xpath("/html/body/div[1]/div/div/article/div/div[1]/div/div/div/div[2]/div/div[2]/form/div/button")).click();


        driver.findElement(By.xpath("//span[@class='et_pb_contact_captcha_question']")).getText();


        if("expected String".equals("actual string"))

           {

              System.out.println("Numbers are the same! ");

           }

         else

          {

              System.out.println("Numbers are changed! ");

          }


        driver.close();


            System.out.println("Test script executed successfully.");


    }



    }


查看完整回答
反對(duì) 回復(fù) 2022-08-03
  • 2 回答
  • 0 關(guān)注
  • 107 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)