-1

code cannot find this icon wherein i have to click it i just notice that it is within a div. here is my sample code:

findLink(By.xpath("//div[@aria-label='Dashlet Actions' and contains(@ng-click,'updateActionMenu')]")).click

please see image for further information

enter image description here

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Mads Cruz
  • 29
  • 6

2 Answers2

0

Use css selector to click.

driver.findElement(By.cssSelector(".btn.btn-link")).click();
Amit Jain
  • 4,389
  • 2
  • 18
  • 21
  • It's working! but the class btn btn-link is not unique is it possible to use the aria-label tag for it using CSS Selector? – Mads Cruz Dec 18 '18 at 07:25
0

To click on the desired element you can use the following solution:

  • css:

    findLink(By.css("button.btn.btn-link[aria-label='Dashlet Actions']")).click
    
  • XPath:

    findLink(By.xpath("//button[@class='btn btn-link' and @aria-label='Dashlet Actions']")).click
    

Note: The element is an Angular element so you have to induce ExplicitWait for the desired element to be clickable

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352