not able to get child element using parsed element in js function

+2 votes
I wrote below javascript code to fetch child object on a page.

component is parent element and data is test data.But  no matter what i try in findelement  getting error -either  element no found or page or by is not defined.

Div.prototype.nele=function(component,data)
{

var children =component.findElement(By.xpath(".//*));

if(children.length!=0){
for(var ele in eles)
{
if(ele!=null){
if(ele.getText()==data.get("text")){
console.log("pass")
break;
}
}
}
}

Please help me with this function, especially find element path where i am getting error
Dec 20, 2019 in Selenium by navikasingh
• 140 points
85 views

You might be missing on the syntax:

var children =component.findElement(By.xpath(".//*"));

Also do have a look at this thread for element not found exception https://www.edureka.co/community/399/selenium-xpath-error-element-not-found

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

Not able to find web element in Span Tag

Try using class selector also. driver.findElement(By.cssSelector(".login-link")).click(); hash is used ...READ MORE

answered Jun 21, 2018 in Selenium by Samarpit
• 5,890 points
3,601 views
0 votes
1 answer

i am not able to perform this method in selenium driver.get("google")

Hi Sachin, are you getting any errors ...READ MORE

answered May 15, 2019 in Selenium by Abha
• 27,930 points
231 views
0 votes
0 answers
0 votes
1 answer

Not able to upload a file in Selenium Webdriver using python Scripting

Hey Srinivas, you can checkout this code ...READ MORE

answered Sep 10, 2019 in Selenium by Abha
• 27,930 points
1,739 views
+1 vote
0 answers

Not able to find the element in a new form in the same webpage ,which popup after clicking a link

I am trying to locate an element ...READ MORE

Jun 26 in Selenium by Reshmi
• 130 points
1,032 views
+1 vote
2 answers
0 votes
1 answer

Not able to use “explicit wait” in my code

To wait until the entire data has ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,510 points
222 views