-1

Unable to click on an element in Browser stack Automate. The same code is running successfully in chrome/firefox.

I am using movetoelement of Actions class to click on a particular element..

Actions action = new Actions(Browser.getCurrentDriver());
action.moveToElement(dividerPageView.clickDividerDropped).click().perform();

Also used Javascript executor but no use.

{
    WebElement element = driver.findElement(By.xpath("//span[contains(@title,'Layout Container')]/following-sibling::div[1]"));
    JavascriptExecutor executor = (JavascriptExecutor)driver;
    executor.executeScript("arguments[0].click();", element);
}

Please suggest another way we can click on a element which is running headless.

Komal12
  • 3,119
  • 4
  • 13
  • 25

1 Answers1

0

You can try:

int items = driver.findelements(by.xpath("YOUR VALUE")).count
if(items == 1) driver.findelement(by.xpath("YOUR VALUE")).click()
DebanjanB
  • 118,661
  • 30
  • 168
  • 217
user7768692
  • 56
  • 1
  • 5