WebDriver : '라디오 버튼'을 클릭 할 수 없음

Gbru

두 개의 개별 클래스에 포함 된 두 세트의 코드를 만들었습니다.

필수 작업 : PH 결제 페이지에서 '현금'버튼을 클릭해야합니다.

  1. 클래스 1 = 간단한 클래스, 간단한 코드 = 코드가 작동하고 현금 옵션을 클릭 할 수 있습니다.
  2. 클래스 2 = 설정에 페이지 개체가 포함됨, 프레임 워크가 다른 구조를 사용함 = 코드가 결제 페이지에 도달 할 때 현금 옵션을 클릭 할 수 없음 = 'org.openqa.selenium.StaleElementReferenceException : 요소가 캐시에 없음'

  3. 두 클래스 내에서 동일한 로케이터를 사용했지만 '2'에서 올바른 로케이터를 사용하면 '라디오'버튼을 클릭 할 수 없습니다. 위에 나열된대로 나열된 오류가 발생합니다. 나는 맞춤형 방법을 만들려고 노력했습니다. 루프 등과 다른 로케이터를 사용하지만 아무것도 작동하지 않습니다.

작업 코드 및 클래스 :

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;

public class TestClass {

    @Test
    public void test() throws InterruptedException {
        //System.setProperty("webdriver.chrome.driver", "C:\\Users\\GBruno\\Desktop\\masteringSelenium\\Framework\\src\\test\\resources\\chromedriver.exe");
       // WebDriver driver = new ChromeDriver();
        WebDriver driver = new FirefoxDriver();

        driver.get("http://www.pizzahut.co.uk");
        driver.manage().window().maximize();

        //click pizza button
        driver.findElement(By.cssSelector("div[id='page'] [href='/menu/pizza']")).click();

        //select any pizza to start order
        driver.findElement(By.cssSelector("div[class='col-xxs-8 col-xs-6 col-sm-8 col-md-7 col-lg-6'] *> button")).click();

        //enter postcode and find hut
        Thread.sleep(2000);
        driver.findElement(By.cssSelector("#ajax-postcode-txt")).sendKeys("TS1 4AG");
        driver.findElement(By.cssSelector(" #get-store-btn")).click();


        //click start order button
        Thread.sleep(3000);
        driver.findElement(By.xpath(".//*[@id='store-collection-section']/div[2]/div[4]/div[4]/div/a")).click();

        //add pizza
        Thread.sleep(5000);
        driver.findElement(By.xpath(".//*[@id='pizza-product-list']/div/div[1]/div/div[2]/div[2]/div[3]/div/form/button")).click();

        //click mini basket
        driver.findElement(By.xpath("html/body/nav/div/div/div[3]/div/div[1]/div[2]/span[3]")).click();

        Thread.sleep(2000);
        //click checkout
        driver.findElement(By.xpath(".//*[@id='divBasket']/div[1]/div/div[2]/div[2]/a")).click();

        Thread.sleep(2000);
        //checkout guest & enter details
        driver.findElement(By.xpath(".//*[@id='frmCheckout']/div[2]/div/div[1]/a")).click();
        driver.findElement(By.xpath(".//*[@id='ddlTitleSelectBoxIt']")).click();
        driver.findElement(By.linkText("Mr")).click();
        driver.findElement(By.xpath(".//*[@id='FirstName']")).sendKeys("Tom");
        driver.findElement(By.xpath(".//*[@id='LastName']")).sendKeys("Hanks");
        driver.findElement(By.xpath(".//*[@id='EmailAddress']")).sendKeys("[email protected]");
        driver.findElement(By.xpath(".//*[@id='ConfirmEmailAddress']")).sendKeys("[email protected]");
        driver.findElement(By.xpath(".//*[@id='PhoneNumber']")).sendKeys("01234 5647890");

        driver.findElement(By.xpath(".//*[@id='btnFindAddress']")).click();

        Thread.sleep(3000);
        driver.findElement(By.xpath(".//*[@id='ddlAddressesToChooseSelectBoxItArrowContainer']")).click();
        driver.findElement(By.linkText("K F C 189-191 Linthorpe Road Middlesbrough TS14AG")).click();
        driver.findElement(By.xpath(".//*[@id='btnContinue']")).click();

        driver.findElement(By.xpath(".//*[@id='payment-methods']/div[1]/div/label/input")).click();

    }
}



코드가 작동하지 않습니다.

public void selectPaymentTypeAndPayForOrder() throws Exception {
    Thread.sleep(3000);
    driver.findElement(By.xpath(".//*[@id='payment-methods']/div[1]/div/label/input")).click();

    driver.findElement(By.cssSelector(" form[id='CheckoutForm'] input[data-paymentname='Cash']")).click(); 
Gbru

다음 코드는 문제를 해결했습니다.

List<WebElement> iframes = driver.findElements(By.tagName("iframe"));
if(iframes.size() == 0) {
    Assert.fail();       
} else {
    // Frames present    
    Assert.assertTrue(true);
}

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Selenium Webdriver에서 라디오 버튼을 클릭 할 수 없습니다.

분류에서Dev

Ruby-Selenium Webdriver, AngularJS 라디오 버튼이 속성을 감지 할 수 없음

분류에서Dev

이 버튼을 클릭 할 수 없습니다. selenium webdriver python

분류에서Dev

ng-repeat에서 라디오 버튼을 클릭 할 수 없습니다.

분류에서Dev

라디오 버튼을 클릭 할 때 변수 값 변경

분류에서Dev

버튼을 클릭 할 수 없음-클릭 비활성화

분류에서Dev

웹 드라이버를 사용하여 버튼을 클릭 할 수 없음

분류에서Dev

Python-Firefox를 통한 Tor 브라우저, 버튼을 클릭 할 수 없음

분류에서Dev

Angularjs-단순 라디오 버튼을 선택할 수 없음

분류에서Dev

GUI에서 '추가'버튼을 클릭 할 수 없음 (오류 : 다른 요소가 클릭을 받게 됨)

분류에서Dev

셀레늄으로 버튼을 클릭 할 수 없음

분류에서Dev

Selenium Python : 버튼을 클릭 할 수 없음

분류에서Dev

HTML 이메일 서명의 버튼을 클릭 할 수 없음

분류에서Dev

ElementClickInterceptedException Selenium이 Python 버튼을 클릭 할 수 없음

분류에서Dev

Flutter 넘친 위치 버튼을 클릭 할 수 없음

분류에서Dev

버튼 셀레늄을 클릭 할 수 없음

분류에서Dev

Python Selemium- 버튼을 클릭 할 수 없음

분류에서Dev

Selenium으로 버튼을 클릭 할 수 없음

분류에서Dev

Android Studio MacOS Big Sur 버튼을 클릭 할 수 없음

분류에서Dev

Swift : UIView 내에 추가 된 버튼을 클릭 할 수 없음

분류에서Dev

UIStackView의 버튼을 클릭 할 수 없음

분류에서Dev

ID를 클릭하여 ID 버튼을 경고 할 수 없음

분류에서Dev

Google+ 로그인 버튼을 클릭 할 수 없음

분류에서Dev

맞춤 환경 설정-버튼을 클릭 할 수 없음

분류에서Dev

앱에서 버튼을 클릭 할 수 없음

분류에서Dev

동적 Tableviewcell의 버튼을 클릭 할 수 없음

분류에서Dev

Android sqlite 버튼을 클릭 할 수 없음

분류에서Dev

Python 셀레늄이 버튼을 클릭 할 수 없음

분류에서Dev

WPF-라디오 버튼을 클릭 할 때 코사인 함수 플로팅

Related 관련 기사

  1. 1

    Selenium Webdriver에서 라디오 버튼을 클릭 할 수 없습니다.

  2. 2

    Ruby-Selenium Webdriver, AngularJS 라디오 버튼이 속성을 감지 할 수 없음

  3. 3

    이 버튼을 클릭 할 수 없습니다. selenium webdriver python

  4. 4

    ng-repeat에서 라디오 버튼을 클릭 할 수 없습니다.

  5. 5

    라디오 버튼을 클릭 할 때 변수 값 변경

  6. 6

    버튼을 클릭 할 수 없음-클릭 비활성화

  7. 7

    웹 드라이버를 사용하여 버튼을 클릭 할 수 없음

  8. 8

    Python-Firefox를 통한 Tor 브라우저, 버튼을 클릭 할 수 없음

  9. 9

    Angularjs-단순 라디오 버튼을 선택할 수 없음

  10. 10

    GUI에서 '추가'버튼을 클릭 할 수 없음 (오류 : 다른 요소가 클릭을 받게 됨)

  11. 11

    셀레늄으로 버튼을 클릭 할 수 없음

  12. 12

    Selenium Python : 버튼을 클릭 할 수 없음

  13. 13

    HTML 이메일 서명의 버튼을 클릭 할 수 없음

  14. 14

    ElementClickInterceptedException Selenium이 Python 버튼을 클릭 할 수 없음

  15. 15

    Flutter 넘친 위치 버튼을 클릭 할 수 없음

  16. 16

    버튼 셀레늄을 클릭 할 수 없음

  17. 17

    Python Selemium- 버튼을 클릭 할 수 없음

  18. 18

    Selenium으로 버튼을 클릭 할 수 없음

  19. 19

    Android Studio MacOS Big Sur 버튼을 클릭 할 수 없음

  20. 20

    Swift : UIView 내에 추가 된 버튼을 클릭 할 수 없음

  21. 21

    UIStackView의 버튼을 클릭 할 수 없음

  22. 22

    ID를 클릭하여 ID 버튼을 경고 할 수 없음

  23. 23

    Google+ 로그인 버튼을 클릭 할 수 없음

  24. 24

    맞춤 환경 설정-버튼을 클릭 할 수 없음

  25. 25

    앱에서 버튼을 클릭 할 수 없음

  26. 26

    동적 Tableviewcell의 버튼을 클릭 할 수 없음

  27. 27

    Android sqlite 버튼을 클릭 할 수 없음

  28. 28

    Python 셀레늄이 버튼을 클릭 할 수 없음

  29. 29

    WPF-라디오 버튼을 클릭 할 때 코사인 함수 플로팅

뜨겁다태그

보관