• <legend id='74Bik'><style id='74Bik'><dir id='74Bik'><q id='74Bik'></q></dir></style></legend>

    1. <small id='74Bik'></small><noframes id='74Bik'>

      <tfoot id='74Bik'></tfoot>
      <i id='74Bik'><tr id='74Bik'><dt id='74Bik'><q id='74Bik'><span id='74Bik'><b id='74Bik'><form id='74Bik'><ins id='74Bik'></ins><ul id='74Bik'></ul><sub id='74Bik'></sub></form><legend id='74Bik'></legend><bdo id='74Bik'><pre id='74Bik'><center id='74Bik'></center></pre></bdo></b><th id='74Bik'></th></span></q></dt></tr></i><div id='74Bik'><tfoot id='74Bik'></tfoot><dl id='74Bik'><fieldset id='74Bik'></fieldset></dl></div>

          <bdo id='74Bik'></bdo><ul id='74Bik'></ul>

        如何执行多个操作并通过 selenium-webdriver 在 URL http://www.spicejet.com

        时间:2023-07-13
        <legend id='RaeRq'><style id='RaeRq'><dir id='RaeRq'><q id='RaeRq'></q></dir></style></legend>

        <small id='RaeRq'></small><noframes id='RaeRq'>

          <tbody id='RaeRq'></tbody>
            <tfoot id='RaeRq'></tfoot>

                <bdo id='RaeRq'></bdo><ul id='RaeRq'></ul>

                • <i id='RaeRq'><tr id='RaeRq'><dt id='RaeRq'><q id='RaeRq'><span id='RaeRq'><b id='RaeRq'><form id='RaeRq'><ins id='RaeRq'></ins><ul id='RaeRq'></ul><sub id='RaeRq'></sub></form><legend id='RaeRq'></legend><bdo id='RaeRq'><pre id='RaeRq'><center id='RaeRq'></center></pre></bdo></b><th id='RaeRq'></th></span></q></dt></tr></i><div id='RaeRq'><tfoot id='RaeRq'></tfoot><dl id='RaeRq'><fieldset id='RaeRq'></fieldset></dl></div>

                • 本文介绍了如何执行多个操作并通过 selenium-webdriver 在 URL http://www.spicejet.com/上单击带有文本的链接作为会员登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我尝试了下面的代码,但它不是鼠标悬停并点击会员登录"

                  I tried the below code but it is not mouse hovering and clicking on 'Member login'

                  WebElement lgn = driver.findElement(By.id("ctl00_HyperLinkLogin"));
                  WebElement ssm = driver.findElement(By.xpath("//a[contains(text(), 'SpiceCash/SpiceClub Members')]"));
                  WebElement cgm = driver.findElement(By.xpath("//a[contains(text(),'Member Login')]"));
                  Actions a1 = new Actions(driver);
                  a1.moveToElement(lgn).moveToElement(ssm).moveToElement(cgm).click().build().perform();
                  

                  推荐答案

                  要在元素上调用 click() 文本为 会员登录,首先你必须 鼠标悬停在元素上,文本为 LOGIN/SIGNUP,然后鼠标悬停在元素上,文本为 SpiceCash/SpiceClub Members 然后诱导 WebDriverWait 使文本为 Member Login 的元素可点击,您可以使用以下解决方案:

                  To invoke click() on the element with text as Member login, first you have to Mouse Hover over the element with text as LOGIN / SIGNUP, then Mouse Hover over the element with text as SpiceCash/SpiceClub Members then induce WebDriverWait for the element with text as Member Login to be clickable and you can use the following solution:

                  • 代码块:

                  • Code Block:

                  import org.openqa.selenium.By;
                  import org.openqa.selenium.WebDriver;
                  import org.openqa.selenium.firefox.FirefoxDriver;
                  import org.openqa.selenium.interactions.Actions;
                  import org.openqa.selenium.support.ui.ExpectedConditions;
                  import org.openqa.selenium.support.ui.WebDriverWait;
                  
                  public class Spicejet_member_login {
                  
                      public static void main(String[] args) {
                  
                          System.setProperty("webdriver.gecko.driver", "C:\Utility\BrowserDrivers\geckodriver.exe");
                          WebDriver driver = new FirefoxDriver();
                          driver.get("http://www.spicejet.com/");
                          new Actions(driver).moveToElement(new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("a.link#ctl00_HyperLinkLogin")))).build().perform();
                          new Actions(driver).moveToElement(new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[@class='hide-mobile']/a[contains(.,'SpiceCash/SpiceClub Members')]")))).build().perform();
                          new WebDriverWait(driver, 7).until(ExpectedConditions.elementToBeClickable(By.xpath("//li[@class='hide-mobile']//ul/li/a[@href='https://book.spicejet.com/Login.aspx' and contains(.,'Member Login')]"))).click();
                      }
                  }
                  

                • 浏览器快照:

                • Browser Snapshot:

                  这篇关于如何执行多个操作并通过 selenium-webdriver 在 URL http://www.spicejet.com/上单击带有文本的链接作为会员登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                • 上一篇:如何通过 main() 和 TestNG 在 IDE 中编写 Selenium Java 应用程序代码 下一篇:无法在 IE 上使用 Java 中的 Selenium WebDriver 获取新窗口句柄

                  相关文章

                  <legend id='sRJ0S'><style id='sRJ0S'><dir id='sRJ0S'><q id='sRJ0S'></q></dir></style></legend>

                  <tfoot id='sRJ0S'></tfoot>

                    1. <i id='sRJ0S'><tr id='sRJ0S'><dt id='sRJ0S'><q id='sRJ0S'><span id='sRJ0S'><b id='sRJ0S'><form id='sRJ0S'><ins id='sRJ0S'></ins><ul id='sRJ0S'></ul><sub id='sRJ0S'></sub></form><legend id='sRJ0S'></legend><bdo id='sRJ0S'><pre id='sRJ0S'><center id='sRJ0S'></center></pre></bdo></b><th id='sRJ0S'></th></span></q></dt></tr></i><div id='sRJ0S'><tfoot id='sRJ0S'></tfoot><dl id='sRJ0S'><fieldset id='sRJ0S'></fieldset></dl></div>

                      <small id='sRJ0S'></small><noframes id='sRJ0S'>

                      • <bdo id='sRJ0S'></bdo><ul id='sRJ0S'></ul>