Selenium (web driver) - cannot click on the right edge of the split button (see image link)

I need your help when clicking on the right edge of the split button (see link for buttons and HTML code)

There are 2 buttons on the screen, and I want to click on the status button (second button) in the right edge.

Problem + Html code:

http://tinypic.com/r/2nbejvp/8

I tried the code below (didn't work).

option 1:

SeleniumApi.driver.findElement(By.xpth("//*[@id='ext-gen51']"));
or
SeleniumApi.driver.findElement(By.id("ext-gen51));

option 2:

 WebElement ele = SeleniumApi.driver.findElement(By.xpath("//*[@id='ext-gen51']"));
 Actions build = new Actions(SeleniumApi.driver);  
 build.moveToElement(ele, (buttonwidth/2)+6, 0).click().build().perform();

option 3:

 WebElement first = SeleniumApi.driver.findElement(By.id("ext-gen51"));
 first.sendKeys(Keys.PAGE_DOWN);

option 4:

WebDriverWait wait = new WebDriverWait(SeleniumApi.driver,30);
By findBy = By.cssSelector("tbody.x-btn-icon-small-left td.x-btn-mr");
WebElement element =    wait.until(ExpectedConditions.elementToBeClickable(findBy));
element.click();

WebDriverWait wait = new WebDriverWait(SeleniumApi.driver,30);
By findBy = By.cssSelector("tbody.x-btn-icon-small-left em.x-btn-split");
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(findBy));
element.click();

option 5:

WebElement ele = SeleniumApi.driver.findElement(By.id("ext-gen51"));
ele.click();
Actions build = new Actions(SeleniumApi.driver);  
build.moveToElement(ele, ele.getSize().getWidth()/2-5, 0).click().perform();

Notes:

page was genrate with extJS infrastructure

I have two split buttons, and I want to click on the second.

+3
source share
4 answers

, findElement(By.id("//*[@id='ext-gen88']")), , //*[@id='ext-gen88'] - xpath a id. , xpath cssSelectors, id, id - .

,

WebElement element = driver.findElement(By.id("ext-gen88"));
element.click();

,

WebElement element = new WebDriverWait(driver,30).until(ExpectedConditions.visibilityOfElementLocated(By.id("ext-gen88")));
element.click();
0

DOM, , extJS. , extJS . , , DOM. , ?

, , ,

, DOM , , . , . .

    WebDriverWait wait = new WebDriverWait(driver,30);
    By findBy = By.cssSelector("tbody.x-btn-icon-small-left em.x-btn-split");
    List<WebElement> elements=wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(findBy));
    if(elements.size()==2) {
        WebElement element = elements.get(1); //if you want to click first buttons arrow, replace 1 with 0.
        element.click();
    }
0

SeleniumApi.driver.findElement(By.id("ext-gen51)); , . , , , , . driver.findElement(By.something), , WebElement table.findElement(By.xpath("tbody"))tbody.findElelements(By.xpath("tr")).get(1). WebElement. td, .
driver.findElement(By.xpath("pathToTable")).findElement(By.xpath("tbody")).findElements(By.xpath("tr")).get(1).findElements(By.xpath("td")).get(2) ! , , ,

0

I ran into the same problem that you described: I need to click the arrow of the split button created using extJS to display the submenu, and then click on one of the menu items that appears as a result.

The solution that seems to work is to click the tag tdnext to em. Thus, the code would be something like this (actually this is a nillesh quote with one change td.x-btn-mrinstead em.x-btn-split):

WebDriverWait wait = new WebDriverWait(driver,30);
By findBy = By.cssSelector("tbody.x-btn-icon-small-left td.x-btn-mr");
List<WebElement> elements=wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(findBy));
if(elements.size()==2) {
    WebElement element = elements.get(1); //if you want to click first buttons arrow, replace 1 with 0.
    element.click();
}
0
source

All Articles