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 21, 2019 in Selenium by navikasingh
• 140 points
601 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,910 points
5,225 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
• 28,140 points
1,556 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
• 28,140 points
3,937 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 27, 2020 in Selenium by Reshmi
• 130 points
1,592 views
+1 vote
2 answers
0 votes
1 answer

Is there a way to get element by XPath using JavaScript in Selenium WebDriver?

You can use the document.evaluate: Evaluates an XPath ...READ MORE

answered Nov 27, 2020 in Selenium by Gitika
• 65,910 points
3,636 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP