自动化轴银行网站 [英] Automate axis bank website

查看:92
本文介绍了自动化轴银行网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想使用以下顺序和代码选择保存帐户.脚本每次都在传递,但是根本没有单击保存帐户. 1.打开轴银行网站. 2.打开产品下拉菜单3.在其中打开帐户"部分4.单击储蓄帐户" 5.在下一页上打开当前帐户"部分

Hi i want to select saving accounts using the following sequence and code . The script is passing every time but saving accounts in not clicked at all. 1. Open axis bank website. 2. Open Products dropdown 3. Open Accounts section in it 4. Click Savings account 5. Open Current Accounts section on next page

driver.get("http://www.axisbank.com/");
Actions action=new Actions(driver);
WebElement prod=driver.findElement(By.id("product"));
WebElement saving=driver.findElement(By.xpath("html/body/form/div[5]/div[1]/div[3]/div/div[1]/div[2]/div/div/ul[2]/ul/li[1]/a"));
WebElement account=driver.findElement(By.xpath("html/body/form/div[5]/div[1]/div[3]/div/div[1]/div[2]/div/div/ul[1]/li[1]/a"));
action.moveToElement(prod).moveToElement(account).moveToElement(saving).click();
Action composite=action.build();
composite.perform();

推荐答案

这对我有用:

    Actions action=new Actions(driver);
//This is just to wait for that mobile window to go..You can add some other logic for that to disappear
            Thread.sleep(15000);
            WebDriverWait wait=new WebDriverWait(driver, 15,3000);
            WebElement prod=wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(".//span[text()='Products']")));
            WebElement saving=driver.findElement(By.xpath(".//a[starts-with(@title,'Savings Accounts')]"));
            WebElement account=driver.findElement(By.xpath(".//a[text()='Accounts']"));
            action.click(prod).perform();
            action.moveToElement(account).perform();
            action.moveToElement(saving).click().perform();

这篇关于自动化轴银行网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆