我的问题是,如果我点击下一个向下的是M,那么我选择橙色的颜色和向下的文本是M但是M大小不是用橙色的,因此它的停止我的要求是一次蓝色我选择M然后添加到包然后在这个之后,在这个下降后,下降应该恢复到它原来的形状选择大小我在我的html和脚本代码的引用中恢复

2022-10-15 08:13:46标签javaseleniumselenium-webdriver
提问

driver.findElement(By.cssSelector("button[title='Blue']")).click();
           waits.until(ExpectedConditions.elementToBeClickable(By.cssSelector("[class='Select-control']")));  
           driver.findElement(By.xpath("//div[@class='Select-control']")).click();
           driver.findElement(By.xpath("//*[text()='M']")).click();
           waits.until(ExpectedConditions.elementToBeClickable(By.cssSelector("[data-cy^='addToBagButton']")));  
           String texts=driver.findElement(By.xpath("//div[@class='Brief']/h1")).getText();
          // System.out.println("the text of select product is"+" " +texts);
           driver.findElement(By.cssSelector("[data-cy^='addToBagButton']")).click();
enter code here
 driver.findElement(By.cssSelector("button[title='Orange']")).click();
           waits.until(ExpectedConditions.elementToBeClickable(By.cssSelector("[class='Select-control']")));
           driver.findElement(By.xpath("//div[@class='Select-control']")).click();
           driver.findElement(By.xpath("//*[text()='S']")).click();  
           waits.until(ExpectedConditions.elementToBeClickable(By.cssSelector("[data-cy^='addToBagButton']"))); 
           driver.findElement(By.cssSelector("[data-cy^='addToBagButton']")).click();
    <div class="Select-control" xpath="1">
<div class="Select-multi-value-wrapper" id="react-select-sizeCode--value">
<div class="Select-placeholder">Select Size</div>
<div aria-expanded="false" aria-owns="" aria-activedescendant="react-select-sizeCode--value" aria-disabled="false" class="Select-input" role="combobox" style="border:0;width:1px;display:inline-block" tabindex="0">
</div>
</div>
<span class="Select-arrow-zone"><svg width="12" height="7" viewBox="0 0 20 10" class="svg">
<path d="M0 0l10 10L20 0" stroke="#2d2d2d" class="svg-stroke"></path>
</svg></span>
</div>

▼版权说明

相关文章也很精彩
推荐内容
更多标签
相关热门
全站排行
随便看看

错说cuoshuo.com——程序员的报错记录

部分内容根据CC版权协议转载,如果您希望取消转载请发送邮件到cuoshuo8@163.com

辽ICP备19011660号-5