0

I am able to go till Parent folder and after on Click Childs will display.

how to write method to get dispalyed child (ON CLICK).

I tried this,

public void TAB1SELECT() { 
   Actions action = new Actions(_driver);
   action.MoveToElement(_driver.FindElement(By.XPath("//[@id='dijit__TreeNode_14']/div[1]/span[3]/span[1] "))).Build().Perform(); 
   var element = (new OpenQA.Selenium.Support.UI.WebDriverWait(_driver, TimeSpan.FromSeconds(30))).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.PresenceOfAllElementsLocatedBy(By.Id("dijit__TreeNode_36_label"))); 
   element[-1].Click(); 
  } 
} 
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • elaborate your question with some more data like what you have tried, your elements xpaths etc – Maran Sowthri Sep 24 '20 at 10:29
  • I tried with public void TAB1SELECT() { Actions action = new Actions(_driver); action.MoveToElement(_driver.FindElement(By.XPath("//*[@id='dijit__TreeNode_14']/div[1]/span[3]/span[1] "))).Build().Perform(); var element = (new OpenQA.Selenium.Support.UI.WebDriverWait(_driver, TimeSpan.FromSeconds(30))).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.PresenceOfAllElementsLocatedBy(By.Id("dijit__TreeNode_36_label"))); element[-1].Click(); } } – user14332917 Sep 24 '20 at 10:31
  • Getting failed at place element[-1].Click();}} – user14332917 Sep 24 '20 at 10:33
  • is it possible to share the app url? – Maran Sowthri Sep 24 '20 at 10:37
  • inorder to veiw application, pulse we need to connect and it is secured, others cannot access – user14332917 Sep 24 '20 at 10:38
  • gotcha give me some time – Maran Sowthri Sep 24 '20 at 10:39
  • Can i share image here to show u?? – user14332917 Sep 24 '20 at 11:45
  • ya that would be great – Maran Sowthri Sep 24 '20 at 12:40
  • GE REPORTS - // This is the Parent and After Clicking on parent Arrow Childs will displays in below format. I am able to reach till GE reports with below code public IWebElement RP1 { get { return (new OpenQA.Selenium.Support.UI.WebDriverWait(_driver, TimeSpan.FromSeconds(30))).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementExists(By.Id("dijit__TreeNode_14_label"))); } } Issue: unable to click on Parent Arrow And open Childs. How to write method for this????? – user14332917 Sep 24 '20 at 13:56
  • i am unable to attach here – user14332917 Sep 24 '20 at 13:58

1 Answers1

0

As you intend to click so instead of PresenceOfAllElementsLocatedBy you need to use VisibilityOfAllElementsLocatedBy(By). Additionally, instead of using index as -1 you need to use the index 0 for the first element and so on. So your effective code block will be:

public void TAB1SELECT() { 
   new Actions(_driver).MoveToElement(_driver.FindElement(By.XPath("//[@id='dijit__TreeNode_14']/div[1]/span[3]/span[1] "))).Build().Perform(); 
   var element = (new OpenQA.Selenium.Support.UI.WebDriverWait(_driver, TimeSpan.FromSeconds(30))).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Id("dijit__TreeNode_36_label"))); 
   element[0].Click(); 
  } 
}
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352