0

I cant generate the proper code to select the specific filter on a BI dashboard I am working on.

I am trying to click on the pencil icon on the filter pane on a BI dashboard however my code combination does not work. Please, any help will be highly appreciated.

<div class="ew-e-gx ew-i-mat f-act running" data-bi-click="XXXXXXAction($event, level, $index)" data-bi-show="!item.disabled &amp;&amp; !item.locked" data-ng-class="{running: opened.edit == 'l'+$index}" data-translate="" data-translate-attr-title="we.actions.editfilter" title="Edit Filter"></di>
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
PeaceT
  • 63
  • 1
  • 7

2 Answers2

0

Try using xpath the bellow :

new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("(//*[@title='Edit Filter' and contains(@class,'ew-e-gx ew-i-mat f-act running')])[1]"))).click();
frianH
  • 7,295
  • 6
  • 20
  • 45
  • Hi @Frian, Thank this code worked but, the issue I have 12 other filters with the same Element. The only thing that change is the class and it shows running when I clicked on each one. Please, can you elaborate more? – PeaceT Aug 20 '19 at 21:21
  • I've updated locator in answer, please try again, that with the related `class`, and i'm add count `[1]`, if available more than one, you can change `[1]` to `[2]` etc, you can highlight in inspect element. – frianH Aug 21 '19 at 00:07
  • Hi Thanks again, This time when I tried the updated code, it returned this error message:Exception in thread "main" org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: By.xpath: //div[@title='Edit Filter' and contains(@data-translate-attr-title, 'editfilter')] (tried for 20 second(s) with 500 milliseconds interval) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48' System info: – PeaceT Aug 21 '19 at 05:19
0

The element is a JavaScript enabled element so you have to induce WebDriverWait for the elementToBeClickable() and you can use either of the following Locator Strategies:

  • cssSelector:

    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("div[title='Edit Filter'][data-translate-attr-title$='editfilter']"))).click();
    
  • xpath:

    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@title='Edit Filter' and contains(@data-translate-attr-title, 'editfilter')]"))).click();
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Hi @DebanjanB, Thank this codes did work but, however, this worked: new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@title='Edit Filter']"))).click(); but the issue I have now is I have, 12 other filters with the same Elements. The only thing that change is the class and it shows running when I clicked on each one. Please, can you look into it a little more? Thank you. – PeaceT Aug 20 '19 at 21:23
  • @PeaceT Can you raise a new question with all the details of your new requirement please? – undetected Selenium Aug 20 '19 at 21:53