Wednesday, June 18, 2025

automated testing – Click on attending to decrease merchandise (beneath dropdown) as an alternative of dropdown in Selenium


I m making an attempt to click on on the dropdown menu merchandise and i’m able to choose the dropdown and the menu merchandise however as an alternative of clicking on merchandise the press goes to the ingredient proper beneath it.

Earlier than the dropdown code, I’m executing the next code to shut the pop up window

            driver.switchTo().window(windowHandle).shut();
            driver.switchTo().window(driver.getWindowHandles().toArray()[0].toString());

I believe this might need one thing to do with click on going to mistaken merchandise

JAVA CODE

driver.findElement(By.xpath("//*[@id='ext-gen32']/desk/tbody/tr[2]/td[2]/em[@class="x-btn-split"]")).click on();
org.openqa.selenium.interactions.Actions motion = new org.openqa.selenium.interactions.Actions(driver);
boolean ele = isElementPresent(By.xpath(Configurations.getServiceLocator("sc.circumstances.arrow")));
String arrow = "//*[@id='ext-gen32']";
WebElement elem = driver.findElement(By.xpath(arrow));
motion.moveToElement(elem, 235, 17);
motion.click on().carry out();

Listing sideBarElements = getElements(By
        .cssSelector("a.x-menu-item"));

for (WebElement ingredient : sideBarElements) {
    if (ingredient.getText().equalsIgnoreCase(“Lookup Contact”)) {
        ingredient.click on();
        break;
    }
}

HTML


Dropdown Html


Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

PHP Code Snippets Powered By : XYZScripts.com