当前位置: 首页 > 知识库问答 >
问题:

Selenium和Java无法访问覆盖页上的信息/按钮[重复]

阳长恨
2023-03-14

我正在尝试创建一个程序,该程序可以完成订购多米诺比萨饼的过程。Selenium和Java一直工作到pizza builder弹出,在这一点上,我不知道如何从中访问任何内容。

我正在使用

WebElement element6=driver.findElement(By.xpath ("//*[text()='Crunchy Thin Cust']"));

要素6。单击();

我包含了包含比萨饼生成器信息的div。当我试图访问其中的任何内容时,我总是出错。我还在构建器内容之前包含了iframe作为参考。

链接是:https://www.dominos.com/en/pages/order/#!/产品/S_比萨饼/builder/?skipCustomize=true

html lang-html prettyprint-override"><iframe id="utag_200_iframe" height="1" width="1" style="display:none" src="//6189720.fls.doubleclick.net/activityi;src=6189720;type=dom;cat=domin000;ord=4014152329515.799?" aria-hidden="true"></iframe>

<iframe sandbox="allow-scripts allow-same-origin" title="Adobe ID Syncing iFrame" id="destination_publishing_iframe_dominos_0" name="destination_publishing_iframe_dominos_0_name" src="https://dominos.demdex.net/dest5.html?d_nsid=0#https%3A%2F%2Fwww.dominos.com" style="display: none; width: 0px; height: 0px;" class="aamIframeLoaded" aria-hidden="true"></iframe>

<iframe name="xdomain-137d3fdb" id="xdomain-137d3fdb" src="https://order.dominos.com/assets/build/xdomain/proxy.html" style="display:none;" aria-hidden="true"></iframe>
<div id="genericOverlay" class="genericOverlay fulfiller-wizard js-fulfillerWizardOverlay" data-quid="generic-overlay-pizzaBuilderDefaultWrapper" coupon-code="">
  <section role="dialog" aria-modal="true" class="card card--overlay js-cardOverlay " data-quid="generic-card-overlay">
    <header class="card__header ">
      <h1 tabindex="-1" data-quid="generic-card-overlay-title" class="card__title "> Domino's Pizza Builder </h1> <button class="card--overlay__close js-closeButton " data-dpz-track-evt-name="×" data-quid="generic-overlay-close" type="button" aria-label="close"></button> </header>
    <div role="document" data-quid="generic-card-overlay-body"
      class="card__body">
      <div class="card__header js-pizzabuilder--header"> </div>
      <div id="pizzaBuilderPage" class="builder--pizza js-pizzaBuilderPage">
        <div class="js-pizzabuilder--couponinfo"></div>
        <div class="js-progressBar progress js-pizzabuilder--progressbar">
          <div class="blockUI is-hidden js-blockUI" style="display: none;">
            <!--  -->
          </div> <button type="button" class="js-progressBarStep pizzaBuilderSizeCrust progress__step c-sizeCrust is-active" id="sizeCrust" data-quid="progress-bar-sizeCrust" aria-label="Size &amp; Crust" data-dpz-track-evt-label="Size &amp; Crust">Size &amp; Crust</button>          <button type="button" class="js-progressBarStep pizzaBuilderCheeseSauce progress__step c-cheeseSauce" id="cheeseSauce" data-quid="progress-bar-cheeseSauce" aria-label="Cheese &amp; Sauce" data-dpz-track-evt-label="Cheese &amp; Sauce">Cheese &amp; Sauce</button>          <button type="button" class="js-progressBarStep pizzaBuilderToppings progress__step c-toppings" id="toppings" data-quid="progress-bar-toppings" aria-label="Toppings" data-dpz-track-evt-label="Toppings">Toppings</button> <button type="button"
            class="js-progressBarStep pizzaBuilderSides progress__step c-sides" id="sides" data-quid="progress-bar-sides" aria-label="Sides" data-dpz-track-evt-label="Sides">Sides</button></div>
        <div class="builder-container">
          <div class="js-pizzabuilder--loadsavedpizza"><button class="btn btn--secondary js-btn-loadUnsavedPizza btn--load-unsaved-pizza is-hidden" data-quid="load-previous-pizza" id="loadUnsavedPizza">Load Previous Pizza</button></div>
          <div class="js-pizzabuilder--helpOption pizza-builder-help-option media--horizontal"></div>
          <div class="visualWrapper js-builderPizzaVisual builder--pizza__visual is-hidden@handheld">
            <div id="heightChanger">
              <!-- Dynamically change the margin above the visual wrapper when #pizzaSummaryInColumn is larger than 220px -->
            </div>
            <div class="js-visualPizzaBubbleOverlay visualPizzaBubbleOverlay"></div>
            <div id="pizzaCanvas" class="canvas-wrapper">
              <!--  --><canvas width="300" height="315" id="crust_canvas" style="display: block; position: absolute; z-index: 0;"></canvas><canvas width="300" height="315" id="mask_canvas" style="display: block; position: absolute; z-index: 15;"></canvas>
              <canvas
                width="300" height="315" id="X_canvas" style="display: block; position: absolute; z-index: 1;"></canvas><canvas width="300" height="315" id="C_canvas" style="display: block; position: absolute; z-index: 1;"></canvas></div>
          </div>
          <div class="card--builder-summary js-pizzabuilder--summarybox" id="pizzaSummaryInColumn">
            <div class="card card--pop">
              <div class="card__header">
                <h2 class="card__title"><span>My Pizza</span></h2>
              </div>
              <div class="card__body grid">
                <div class="variantDescription order-summary grid__cell--1">
                  <div class="order-summary__item">
                    <h3 class="order-summary__item__title" data-quid="item-title">Large (14") Hand Tossed Pizza</h3>
                    <ul class="order-summary__item__topping-list" data-quid="item-topping-list">
                      <li data-quid="whole-topping-list-">Cheese </li>
                      <li></li>
                      <li></li>
                    </ul>
                    <ul class="order-summary__item__cooking-instructions">
                      <li></li>
                    </ul>
                  </div>
                </div>
                <p class="quantitySelect grid__cell--1@desktop grid__cell--1/3">Quantity:
                  <select aria-label="Quantity:" class="quantity" name="S_PIZZA|Quantity">
                    <!-- -->
                    <option selected="" value="1">
                      1
                    </option>
                    <option value="2">
                      2
                    </option>
                    <option value="3">
                      3
                    </option>
                    <option value="4">
                      4
                    </option>
                    <option value="5">
                      5
                    </option>
                    <option value="6">
                      6
                    </option>
                    <option value="7">
                      7
                    </option>
                    <option value="8">
                      8
                    </option>
                    <option value="9">
                      9
                    </option>
                    <option value="10">
                      10
                    </option>
                    <option value="11">
                      11
                    </option>
                    <option value="12">
                      12
                    </option>
                    <option value="13">
                      13
                    </option>
                    <option value="14">
                      14
                    </option>
                    <option value="15">
                      15
                    </option>
                    <option value="16">
                      16
                    </option>
                    <option value="17">
                      17
                    </option>
                    <option value="18">
                      18
                    </option>
                    <option value="19">
                      19
                    </option>
                    <option value="20">
                      20
                    </option>
                    <option value="21">
                      21
                    </option>
                    <option value="22">
                      22
                    </option>
                    <option value="23">
                      23
                    </option>
                    <option value="24">
                      24
                    </option>
                    <option value="25">
                      25
                    </option>
                  </select>
                </p>
                <div class="grid__cell--1@desktop grid__cell--2/3 pizza-builder__add-btn-container"> <button class="btn btn--large js-isNew js-addPizza btn--block c-order-addToOrder" data-quid="add-pizzabuilder-button">Add to Order</button> </div>
              </div>
            </div>
            <div class="js-toppingsMsg is-hidden@handheld is-hidden" data-quid="toppings-msg-desktop"></div>
          </div>
          <div class="selectionBoard selection-board js-selectionBoard">
            <div data-quid="desktop-pizza-builder-btn-container" class="form__control-group--actions--steps js-buttons--prev-next is-hidden@handheld">
              <div> <button class="js-prev js-prevnext btn btn--small btn--secondary btn--back c-order-back is-hidden" data-quid="pizza-builder-prev-btn" type="button"> Back </button> </div>
              <div> <button class="js-next js-prevnext btn btn--small btn--next c-order-nextStep " data-quid="pizza-builder-next-btn" type="button"> Cheese &amp; Sauce </button> </div>
            </div>
            <div class="js-toppingsMsg is-hidden@desktop is-hidden" data-quid="toppings-msg-mobile">&nbsp;</div>
            <div class="card card--pop card--pizza-options">
              <div class="builderWrapper card__body js-builderWrapper js-pizzabuilder--step-wrapper">
                <div id="SizeCrustWrapper" class="grid sizes-wrapper js-sizeCrustWrapper">
                  <div class="grid__cell--5/8 is-hidden@handheld sizes-wrapper__step-crust">
                    <h2 class="sizes-wrapper__step-title"> Choose Your Crust </h2>
                  </div>
                  <div class="grid__cell--3/8 is-hidden@handheld sizes-wrapper__step-size">
                    <h2 class="sizes-wrapper__step-title"> Choose Your Size </h2>
                  </div>
                  <div class="grid__cell--1 is-hidden@desktop">
                    <h2 class="sizes-wrapper__step-title"> Choose Your Size &amp; Crust </h2>
                    <div class="sizes-wrapper__sizes-help-subtitle"> Tap to Select a Size </div>
                  </div>
                  <div class="grid__cell--1 grid__cell--3/8@desktop sizes-wrapper__step-1">
                    <div class="grid">
                      <div class="sizes-wrapper__size sizes-wrapper__size--10 grid__cell--1@desktop"> <label class="sizes-wrapper__size-label js-size-label" data-quid="pizza-size-10"> <input type="radio" id="pizza_size|10" data-sizecode="10" name="pizza_size" class="sizes-wrapper__size-input js-size" value="" data-quid="pizza-size-10-input"> <span class="sizes-wrapper__size-code sizes-wrapper__size-code--0 sizes-wrapper__size-code--10" data-quid="pizza-size-10-size">10"</span> <span class="sizes-wrapper__size-name" data-quid="pizza-size-10-name">Small</span> </label>                        </div>
                      <div class="sizes-wrapper__size sizes-wrapper__size--12 grid__cell--1@desktop"> <label class="sizes-wrapper__size-label js-size-label" data-quid="pizza-size-12"> <input type="radio" id="pizza_size|12" data-sizecode="12" name="pizza_size" class="sizes-wrapper__size-input js-size" value="" data-quid="pizza-size-12-input"> <span class="sizes-wrapper__size-code sizes-wrapper__size-code--1 sizes-wrapper__size-code--12" data-quid="pizza-size-12-size">12"</span> <span class="sizes-wrapper__size-name" data-quid="pizza-size-12-name">Medium</span> </label>                        </div>
                      <div class="sizes-wrapper__size sizes-wrapper__size--14 grid__cell--1@desktop"> <label class="sizes-wrapper__size-label js-size-label" data-quid="pizza-size-14"> <input type="radio" id="pizza_size|14" data-sizecode="14" name="pizza_size" class="sizes-wrapper__size-input js-size" value="" data-quid="pizza-size-14-input" checked="true"> <span class="sizes-wrapper__size-code sizes-wrapper__size-code--2 sizes-wrapper__size-code--14" data-quid="pizza-size-14-size">14"</span> <span class="sizes-wrapper__size-name" data-quid="pizza-size-14-name">Large</span> </label>                        </div>
                      <div class="sizes-wrapper__size sizes-wrapper__size--16 grid__cell--1@desktop"> <label class="sizes-wrapper__size-label js-size-label" data-quid="pizza-size-16"> <input type="radio" id="pizza_size|16" data-sizecode="16" name="pizza_size" class="sizes-wrapper__size-input js-size" value="" data-quid="pizza-size-16-input"> <span class="sizes-wrapper__size-code sizes-wrapper__size-code--3 sizes-wrapper__size-code--16" data-quid="pizza-size-16-size">16"</span> <span class="sizes-wrapper__size-name" data-quid="pizza-size-16-name">X-Large</span> </label>                        </div>
                    </div>
                  </div>
                  <div class="grid__cell--1 grid__cell--5/8@desktop grid__cell--1/2@kiosk js-step-2 sizes-wrapper__step-2">
                    <div class="sizes-wrapper__crusts-container js-crusts is-hidden" data-crusts-for="pizza_size|10">
                      <div class="sizes-wrapper__crust"> <input id="crust_type|10HANDTOSS" class="sizes-wrapper__crust-radio js-crust-input c-crust-10SCREEN" data-default-crust="" data-flavorcode="HANDTOSS" data-sizecode="10" name="S_PIZZA|Variant" type="radio" value="10SCREEN" data-quid="crust-input-10SCREEN">                        <label for="crust_type|10HANDTOSS" class="sizes-wrapper__crust-label"> <span class="sizes-wrapper__crust-name" data-quid="pizza-builder-crust-name-10HANDTOSS">  Hand Tossed </span> <span class="sizes-wrapper__crust-description" data-quid="pizza-builder-crust-desc">Garlic-seasoned crust with a rich, buttery taste.</span> </label>                        </div>
                    </div>
                    <div class="sizes-wrapper__crusts-container js-crusts is-hidden" data-crusts-for="pizza_size|10">
                      <div class="sizes-wrapper__crust"> <input id="crust_type|10THIN" class="sizes-wrapper__crust-radio js-crust-input c-crust-10THIN" data-flavorcode="THIN" data-sizecode="10" name="S_PIZZA|Variant" type="radio" value="10THIN" data-quid="crust-input-10THIN"> <label for="crust_type|10THIN"
                          class="sizes-wrapper__crust-label"> <span class="sizes-wrapper__crust-name" data-quid="pizza-builder-crust-name-10THIN">  Crunchy Thin Crust </span> <span class="sizes-wrapper__crust-description" data-quid="pizza-builder-crust-desc">Thin enough for the optimum crispy to crunchy ratio and square cut to be perfectly sharable.</span> </label>                        </div>
                    </div>
                    <div class="sizes-wrapper__crusts-container js-crusts is-hidden" data-crusts-for="pizza_size|10">
                      <div class="sizes-wrapper__crust"> <input id="crust_type|10GLUTENF" class="sizes-wrapper__crust-radio js-crust-input c-crust-P10IGFZA" data-flavorcode="GLUTENF" data-sizecode="10" name="S_PIZZA|Variant" type="radio" value="P10IGFZA" data-quid="crust-input-P10IGFZA">                        <label for="crust_type|10GLUTENF" class="sizes-wrapper__crust-label"> <span class="sizes-wrapper__crust-name" data-quid="pizza-builder-crust-name-10GLUTENF">  Gluten Free Crust </span> <span class="sizes-wrapper__crust-description" data-quid="pizza-builder-crust-desc">Domino's pizza made with a Gluten Free Crust.</span> </label>                        </div>
                    </div>
                    <div class="sizes-wrapper__crusts-container js-crusts is-hidden" data-crusts-for="pizza_size|12">
                      <div class="sizes-wrapper__crust"> <input id="crust_type|12HANDTOSS" class="sizes-wrapper__crust-radio js-crust-input c-crust-12SCREEN" data-default-crust="" data-flavorcode="HANDTOSS" data-sizecode="12" name="S_PIZZA|Variant" type="radio" value="12SCREEN" data-quid="crust-input-12SCREEN">                        <label for="crust_type|12HANDTOSS" class="sizes-wrapper__crust-label"> <span class="sizes-wrapper__crust-name" data-quid="pizza-builder-crust-name-12HANDTOSS">  Hand Tossed </span> <span class="sizes-wrapper__crust-description" data-quid="pizza-builder-crust-desc">Garlic-seasoned crust with a rich, buttery taste.</span> </label>                        </div>
                    </div>
                    <div class="sizes-wrapper__crusts-container js-crusts is-hidden" data-crusts-for="pizza_size|12">
                      <div class="sizes-wrapper__crust"> <input id="crust_type|12THIN" class="sizes-wrapper__crust-radio js-crust-input c-crust-12THIN" data-flavorcode="THIN" data-sizecode="12" name="S_PIZZA|Variant" type="radio" value="12THIN" data-quid="crust-input-12THIN"> <label for="crust_type|12THIN"
                          class="sizes-wrapper__crust-label"> <span class="sizes-wrapper__crust-name" data-quid="pizza-builder-crust-name-12THIN">  Crunchy Thin Crust </span> <span class="sizes-wrapper__crust-description" data-quid="pizza-builder-crust-desc">Thin enough for the optimum crispy to crunchy ratio and square cut to be perfectly sharable.</span> </label>                        </div>
                    </div>
                    <div class="sizes-wrapper__crusts-container js-crusts is-hidden" data-crusts-for="pizza_size|12">
                      <div class="sizes-wrapper__crust"> <input id="crust_type|12NPAN" class="sizes-wrapper__crust-radio js-crust-input c-crust-P12IPAZA" data-flavorcode="NPAN" data-sizecode="12" name="S_PIZZA|Variant" type="radio" value="P12IPAZA" data-quid="crust-input-P12IPAZA">
                        <label
                          for="crust_type|12NPAN" class="sizes-wrapper__crust-label"> <span class="sizes-wrapper__crust-name" data-quid="pizza-builder-crust-name-12NPAN">  Handmade Pan </span> <span class="sizes-wrapper__crust-description" data-quid="pizza-builder-crust-desc">Two layers of cheese, toppings to the edge, baked in a pan for a crust that is golden and crispy with a buttery taste.</span>                          </label>
                      </div>
                    </div>
                    <div class="sizes-wrapper__crusts-container js-crusts" data-crusts-for="pizza_size|14">
                      <div class="sizes-wrapper__crust"> <input id="crust_type|14BK" class="sizes-wrapper__crust-radio js-crust-input c-crust-PBKIREZA" data-flavorcode="BK" data-sizecode="14" name="S_PIZZA|Variant" type="radio" value="PBKIREZA" data-quid="crust-input-PBKIREZA">
                        <label
                          for="crust_type|14BK" class="sizes-wrapper__crust-label"> <span class="sizes-wrapper__crust-name" data-quid="pizza-builder-crust-name-14BK">  Brooklyn Style </span> <span class="sizes-wrapper__crust-description" data-quid="pizza-builder-crust-desc">Hand stretched to be big, thin and perfectly foldable.</span>                          </label>
                      </div>
                    </div>
                    <div class="sizes-wrapper__crusts-container js-crusts" data-crusts-for="pizza_size|14">
                      <div class="sizes-wrapper__crust"> <input id="crust_type|14HANDTOSS" class="sizes-wrapper__crust-radio js-crust-input c-crust-14SCREEN" data-default-crust="" data-flavorcode="HANDTOSS" data-sizecode="14" name="S_PIZZA|Variant" type="radio" value="14SCREEN" data-quid="crust-input-14SCREEN">                        <label for="crust_type|14HANDTOSS" class="sizes-wrapper__crust-label"> <span class="sizes-wrapper__crust-name" data-quid="pizza-builder-crust-name-14HANDTOSS">  Hand Tossed </span> <span class="sizes-wrapper__crust-description" data-quid="pizza-builder-crust-desc">Garlic-seasoned crust with a rich, buttery taste.</span> </label>                        </div>
                    </div>
                    <div class="sizes-wrapper__crusts-container js-crusts" data-crusts-for="pizza_size|14">
                      <div class="sizes-wrapper__crust"> <input id="crust_type|14THIN" class="sizes-wrapper__crust-radio js-crust-input c-crust-14THIN" data-flavorcode="THIN" data-sizecode="14" name="S_PIZZA|Variant" type="radio" value="14THIN" data-quid="crust-input-14THIN"> <label for="crust_type|14THIN"
                          class="sizes-wrapper__crust-label"> <span class="sizes-wrapper__crust-name" data-quid="pizza-builder-crust-name-14THIN">  Crunchy Thin Crust </span> <span class="sizes-wrapper__crust-description" data-quid="pizza-builder-crust-desc">Thin enough for the optimum crispy to crunchy ratio and square cut to be perfectly sharable.</span> </label>                        </div>
                    </div>
                    <div class="sizes-wrapper__crusts-container js-crusts is-hidden" data-crusts-for="pizza_size|16">
                      <div class="sizes-wrapper__crust"> <input id="crust_type|16BK" class="sizes-wrapper__crust-radio js-crust-input c-crust-P16IBKZA" data-default-crust="" data-flavorcode="BK" data-sizecode="16" name="S_PIZZA|Variant" type="radio" value="P16IBKZA" data-quid="crust-input-P16IBKZA">                        <label for="crust_type|16BK" class="sizes-wrapper__crust-label"> <span class="sizes-wrapper__crust-name" data-quid="pizza-builder-crust-name-16BK">  Brooklyn Style </span> <span class="sizes-wrapper__crust-description" data-quid="pizza-builder-crust-desc">Hand stretched to be big, thin and perfectly foldable.</span> </label>                        </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="js-cookingInstructions cooking-instructions card card--pop card--pizza-options">
            <div class="card__body grid">
              <div class="grid__cell--1">
                <h3 class="section-title collapsed">Special Instructions</h3> <a class="button--cooking-instructions js-cookingInstructionsToggle collapsed" data-dpz-track-evt-name="special instructions-expanded" data-dpz-track-evt-category="button" href="#">+</a>
                <div id="cookingInstructionsContainer"
                  class="grid is-hidden js-cookingInstructionsContainer clr">
                  <div class="cooking-instruction-group product grid__cell--1 grid__cell--1/4@desktop grid__cell--1/3@widescreen" data-variant="14SCREEN">
                    <h3 class="step-title">Bake</h3>
                    <div class="cooking-instruction-group__toggles">
                      <div class="row cooking-instruction-group__toggle"> <label> <input class="js-selectCookingInstruction" type="radio" data-code="WD" data-default="false" data-description="Well Done" name="BAKE"> <span class="btn--toggle">Well Done</span> </label> </div>
                      <div class="row cooking-instruction-group__toggle">
                      <label> <input class="js-selectCookingInstruction" type="radio" data-code="NB" data-default="true" data-description="Normal Bake" name="BAKE"> <span class="btn--toggle">Normal Bake</span> </label> </div>
                    </div>
                  </div>
                  <div class="cooking-instruction-group product grid__cell--1 grid__cell--1/4@desktop grid__cell--1/3@widescreen" data-variant="14SCREEN">
                    <h3 class="step-title">Seasoning</h3>
                    <div class="cooking-instruction-group__toggles">
                      <div class="row cooking-instruction-group__toggle"> <label> <input class="js-selectCookingInstruction" type="radio" data-code="GO" data-default="true" data-description="Garlic-Seasoned Crust" name="SEASONING"> <span class="btn--toggle">Garlic-Seasoned Crust</span> </label> </div>
                      <div class="row cooking-instruction-group__toggle"> <label> <input class="js-selectCookingInstruction" type="radio" data-code="NGO" data-default="false" data-description="No Garlic-Seasoned Crust" name="SEASONING"> <span class="btn--toggle">No Garlic-Seasoned Crust</span> </label>                        </div>
                    </div>
                  </div>
                  <div class="cooking-instruction-group product grid__cell--1 grid__cell--1/4@desktop grid__cell--1/3@widescreen" data-variant="14SCREEN">
                    <h3 class="step-title">Cut</h3>
                    <div class="cooking-instruction-group__toggles">
                      <div class="row cooking-instruction-group__toggle"> <label> <input class="js-selectCookingInstruction" type="radio" data-code="PIECT" data-default="true" data-description="Pie Cut" name="CUT"> <span class="btn--toggle">Pie Cut</span> </label> </div>
                      <div class="row cooking-instruction-group__toggle">
                      <label> <input class="js-selectCookingInstruction" type="radio" data-code="SQCT" data-default="false" data-description="Square Cut" name="CUT"> <span class="btn--toggle">Square Cut</span> </label> </div>
                      <div class="row cooking-instruction-group__toggle">
                      <label> <input class="js-selectCookingInstruction" type="radio" data-code="UNCT" data-default="false" data-description="Uncut" name="CUT"> <span class="btn--toggle">Uncut</span> </label> </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div data-quid="handheld-pizza-builder-btn-container" class="form__control-group--actions--steps js-buttons--prev-next is-hidden@desktop">
            <div> <button class="js-prev js-prevnext btn btn--small btn--secondary btn--back c-order-back is-hidden" data-quid="pizza-builder-prev-btn" type="button"> Back </button> </div>
            <div> <button class="js-next js-prevnext btn btn--small btn--next c-order-nextStep " data-quid="pizza-builder-next-btn" type="button"> Cheese &amp; Sauce </button> </div>
          </div>
        </div>
        <p class="is-hidden@handheld"> The Pizza Builder will always show a large pizza. If you choose a different size, the topping amounts will vary. The deliciousness, however, will not.</p>
      </div>
    </div>
  </section>
</div>

共有1个答案

丌官翰采
2023-03-14

似乎你的元素是在比萨饼建筑框架/窗口下。至少我在网站上看到的是提供的xpath和链接。对我来说,xpath工作发现单选按钮很好://输入[@id='crust_type|14THIN']

如果常规单击不起作用,您可以尝试使用JavaScriptExecutor。单击操作看起来应该非常像:

JavascriptExecutor jse = (JavascriptExecutor) driver;
WebElement element6 = driver.findElement(By.xpath("//*[text()='Crunchy Thin Crust']"));
jse.executeScript("arguments[0].click();", element6);
 类似资料:
  • 问题内容: 如何在自己的应用程序中复制此功能? 我认为肯定有三种可能性… 捕获后退按钮的按下(如下所示),然后调用home按钮调用的任何方法。 捕获后退按钮按下,然后欺骗主页按钮。 捕获后退按钮的按下,然后启动主屏幕的活动,从而有效地将应用程序的活动置于停止状态。 编辑: 我知道有关服务,并且正在与此问题相关的应用程序中使用一种。该问题专门用于在按“后退”按钮时将活动置于停止状态而不是已破坏状态。

  • 错误msg: 我也尝试过将标签名称作为按钮。 超文本标记语言: 我的代码:

  • 好吧,我正在做一些事情,我想禁用设备的所有硬按钮。 硬按钮,如电源、主页、调高音量、调低音量、搜索、返回。 除了Power,我已经成功地覆盖了这里的几乎所有按钮。 所以我只想让你们看到,请分享一些想法,这样我就可以不受影响了。 我在获得长按电源键事件,就像我想抓住相同的短按一样。此外,当按下电源时,我还试图通过获取的来停止屏幕关闭,我成功地接收了它,但我无法处理它。 谢谢。 然后,我创建了一个接收

  • 问题内容: 假设我在课堂上说两种方法 和 那是什么感觉 重载还是重载? 问题答案: 重载是指两个或多个具有相同名称但参数不同的方法,就像您的示例一样。重载是从接口或抽象类实现一个方法的,因此超类中的方法具有实现,而子类中的方法具有不同的实现,它们仍然具有相同的方法名称和参数。

  • 我的对话框是扩展TitleArea对话框。在对话框上,我有一个关闭对话框按钮。它基本上只是调用方法关闭();当按钮被单击时。 我遇到的问题是,当用户单击窗口关闭(红色X)时,它调用的不是关闭方法。我认为这可能是调用Cancel方法。 检查returnCode,我看到当按下close时,它返回0。但当按下X时,返回1。 如何覆盖X键,只调用关闭方法,如按钮按下?

  • 与SonarQube类似,它不会通过Gradle显示每个文件的详细报告,但不会显示dupe。 声纳Qube版本3.7.4 Gradle版本2.1 运行会生成一个文件test.execSonar会拾取该文件 然而,在刷新上述项目时,它显示覆盖率为0% 单元测试覆盖率 0.0% 0.0% 线路覆盖率 0.0% 分支覆盖率 我已经设定好了 我已经尝试了\和向前斜杠-这没有区别 有什么想法吗? 编辑 根据