【问题标题】:Salesforce tab buttons automation using webdriver使用 webdriver 的 Salesforce 选项卡按钮自动化
【发布时间】:2015-01-16 19:52:19
【问题描述】:

我是 webdriver 和 selenium 的新手,在自动化 Salesforce 页面时,我想单击 Account_Tab。我正在使用driver.findElement(By.id("Account_Tab")).click(); 我所能做的就是看到它是用

启用的
if driver.findElement(By.id("Account_Tab")).isEnabled())

我错过了什么不允许我点击那个标签。详情请查看 HTML:

    <ul id= "`enter code here`tabBar" class="zen-inlineList zen-tabMenu">
<li id="home_Tab" class="brandPrimaryBgr primaryPalette zen-active zen-firstItem primaryPalette">
<li id="Account_Tab">
<a title="Accounts Tab" href="/001/o">Accounts</a>
</li>

【问题讨论】:

    标签: automation webdriver salesforce


    【解决方案1】:

    请尝试使用以下任一代码单击“帐户”标签

    1- driver.findElement(By.xpath("//li[@id='Account_Tab']/a")).click();
    这将在 'li' 元素下找到 'a' 元素,id 为 'Account_Tab' 并点击它。

    2- driver.findElement(By.xpath("//a[@title='Accounts Tab']")).click();
    这将找到标题为“Accounts Tab”的'a'元素并点击它。

    3- driver.findElement(By.xpath("//a[.='Accounts']")).click();
    这将定位 'a' 元素,其中的 innerHTML/text 准确为“Accounts”,然后单击它。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-18
    • 2019-06-08
    • 1970-01-01
    • 2014-03-07
    相关资源
    最近更新 更多