Quantcast

How to find element visible status....is this selenium bug or limitation ????

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to find element visible status....is this selenium bug or limitation ????

Vinothkumar Velusamy
Hi,

consider below code....

<div id = "Parent" style = "display : block">
    <div id = "child_1">
       <div id = "child_2">
          <div id = "child_3">
             <input id ="input_1" type = "text">
          </div>
      </div>
   </div>
</div>

now if i need to get the input path, i am doing by //input[@id="input_1"].. this will identify input path. suppose , if "style = "display : block"" is set to parent as mentioned in the above code, this is getting displayed in the html page , works fine with automation also.

if i change the style to set as  "style = "display : none", then the page will not display in the browser since the style is setted as none for the parent level. now if i execute the script which contains the code for  //input[@id="input_1"] alone, the findelementbyXpath able to find the element though it is not visible to the user level. 

now the question is :
how to get whether the parent style is set to none or not. Please note; i dont want to travel from parent path to child path.. i mean , i dont want to start from "//div[@id = "Parent" and contains[@style = "display : block"]]/div/div/div/input...
rather i need to find the parent of particular element dynamically.......... in this case... div id=parent ......

Thanks for the info in advance...

regards
Vinothkumar Velusamy

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/dcc8918b-7e34-4ae7-a12c-f4020f7b082a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to find element visible status....is this selenium bug or limitation ????

shammi
If you are changing style  "style = "display : none", then it won't find element because webdriver doesn't work on hidden elements.

On Tuesday, 18 June 2013 19:53:10 UTC+5:30, Vinothkumar Velusamy wrote:
Hi,

consider below code....

<div id = "Parent" style = "display : block">
    <div id = "child_1">
       <div id = "child_2">
          <div id = "child_3">
             <input id ="input_1" type = "text">
          </div>
      </div>
   </div>
</div>

now if i need to get the input path, i am doing by //input[@id="input_1"].. this will identify input path. suppose , if "style = "display : block"" is set to parent as mentioned in the above code, this is getting displayed in the html page , works fine with automation also.

if i change the style to set as  "style = "display : none", then the page will not display in the browser since the style is setted as none for the parent level. now if i execute the script which contains the code for  //input[@id="input_1"] alone, the findelementbyXpath able to find the element though it is not visible to the user level. 

now the question is :
how to get whether the parent style is set to none or not. Please note; i dont want to travel from parent path to child path.. i mean , i dont want to start from "//div[@id = "Parent" and contains[@style = "display : block"]]/div/div/div/input...
rather i need to find the parent of particular element dynamically.......... in this case... div id=parent ......

Thanks for the info in advance...

regards
Vinothkumar Velusamy

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0f5d05c4-754b-4f4a-a32a-398171648478%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to find element visible status....is this selenium bug or limitation ????

Krishnan Mahadevan
@Shammi,
That's not true. AFAIK the only time when WebDriver would throw an error is when it cannot find an element in the DOM. 

Irrespective of whether an element is *visible* or not WebDriver would find the element but it will only interact with visible elements to the user. 

On Wednesday, June 19, 2013, shammi wrote:
If you are changing style  "style = "display : none", then it won't find element because webdriver doesn't work on hidden elements.

On Tuesday, 18 June 2013 19:53:10 UTC+5:30, Vinothkumar Velusamy wrote:
Hi,

consider below code....

<div id = "Parent" style = "display : block">
    <div id = "child_1">
       <div id = "child_2">
          <div id = "child_3">
             <input id ="input_1" type = "text">
          </div>
      </div>
   </div>
</div>

now if i need to get the input path, i am doing by //input[@id="input_1"].. this will identify input path. suppose , if "style = "display : block"" is set to parent as mentioned in the above code, this is getting displayed in the html page , works fine with automation also.

if i change the style to set as  "style = "display : none", then the page will not display in the browser since the style is setted as none for the parent level. now if i execute the script which contains the code for  //input[@id="input_1"] alone, the findelementbyXpath able to find the element though it is not visible to the user level. 

now the question is :
how to get whether the parent style is set to none or not. Please note; i dont want to travel from parent path to child path.. i mean , i dont want to start from "//div[@id = "Parent" and contains[@style = "display : block"]]/div/div/div/input...
rather i need to find the parent of particular element dynamically.......... in this case... div id=parent ......

Thanks for the info in advance...

regards
Vinothkumar Velusamy

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;selenium-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">selenium-users+unsubscribe@....
To post to this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;selenium-users@googlegroups.com&#39;);" target="_blank">selenium-users@....
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0f5d05c4-754b-4f4a-a32a-398171648478%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLkOtuvEG05WTtDrOevuUozbCftzX4cW7uuoFmoqtqp4pg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to find element visible status....is this selenium bug or limitation ????

Vinothkumar Velusamy
Any idea guys how to identify the style of the parent .... from my example ? ? ? ? ? 

On Wed, Jun 19, 2013 at 6:17 AM, Krishnan Mahadevan <[hidden email]> wrote:
@Shammi,
That's not true. AFAIK the only time when WebDriver would throw an error is when it cannot find an element in the DOM. 

Irrespective of whether an element is *visible* or not WebDriver would find the element but it will only interact with visible elements to the user. 


On Wednesday, June 19, 2013, shammi wrote:
If you are changing style  "style = "display : none", then it won't find element because webdriver doesn't work on hidden elements.

On Tuesday, 18 June 2013 19:53:10 UTC+5:30, Vinothkumar Velusamy wrote:
Hi,

consider below code....

<div id = "Parent" style = "display : block">
    <div id = "child_1">
       <div id = "child_2">
          <div id = "child_3">
             <input id ="input_1" type = "text">
          </div>
      </div>
   </div>
</div>

now if i need to get the input path, i am doing by //input[@id="input_1"].. this will identify input path. suppose , if "style = "display : block"" is set to parent as mentioned in the above code, this is getting displayed in the html page , works fine with automation also.

if i change the style to set as  "style = "display : none", then the page will not display in the browser since the style is setted as none for the parent level. now if i execute the script which contains the code for  //input[@id="input_1"] alone, the findelementbyXpath able to find the element though it is not visible to the user level. 

now the question is :
how to get whether the parent style is set to none or not. Please note; i dont want to travel from parent path to child path.. i mean , i dont want to start from "//div[@id = "Parent" and contains[@style = "display : block"]]/div/div/div/input...
rather i need to find the parent of particular element dynamically.......... in this case... div id=parent ......

Thanks for the info in advance...

regards
Vinothkumar Velusamy

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0f5d05c4-754b-4f4a-a32a-398171648478%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLkOtuvEG05WTtDrOevuUozbCftzX4cW7uuoFmoqtqp4pg%40mail.gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Best Regards,
Vinoth V
Cell:+91-9740-629-246

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAHsdjV3UUHdKRrga%2BgB4Qu5UGB-aw5r6ppDj0ShhA1EL%3Dv3sig%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to find element visible status....is this selenium bug or limitation ????

sirus tula
Hi Vinoth,

I think you can check if the element is visible or not by writing the following statements. The statement below will check if the element is present/displayed and clicks it if it is displayed.

if(driver.findElement(By.cssSelector("input#input_1")).isDisplayed())
{
   driver.findElement(By.cssSelector("input#input_1")).click();
}

Hope that helps.


On Fri, Jun 21, 2013 at 1:53 PM, Vinothkumar Velusamy <[hidden email]> wrote:
Any idea guys how to identify the style of the parent .... from my example ? ? ? ? ? 


On Wed, Jun 19, 2013 at 6:17 AM, Krishnan Mahadevan <[hidden email]> wrote:
@Shammi,
That's not true. AFAIK the only time when WebDriver would throw an error is when it cannot find an element in the DOM. 

Irrespective of whether an element is *visible* or not WebDriver would find the element but it will only interact with visible elements to the user. 


On Wednesday, June 19, 2013, shammi wrote:
If you are changing style  "style = "display : none", then it won't find element because webdriver doesn't work on hidden elements.

On Tuesday, 18 June 2013 19:53:10 UTC+5:30, Vinothkumar Velusamy wrote:
Hi,

consider below code....

<div id = "Parent" style = "display : block">
    <div id = "child_1">
       <div id = "child_2">
          <div id = "child_3">
             <input id ="input_1" type = "text">
          </div>
      </div>
   </div>
</div>

now if i need to get the input path, i am doing by //input[@id="input_1"].. this will identify input path. suppose , if "style = "display : block"" is set to parent as mentioned in the above code, this is getting displayed in the html page , works fine with automation also.

if i change the style to set as  "style = "display : none", then the page will not display in the browser since the style is setted as none for the parent level. now if i execute the script which contains the code for  //input[@id="input_1"] alone, the findelementbyXpath able to find the element though it is not visible to the user level. 

now the question is :
how to get whether the parent style is set to none or not. Please note; i dont want to travel from parent path to child path.. i mean , i dont want to start from "//div[@id = "Parent" and contains[@style = "display : block"]]/div/div/div/input...
rather i need to find the parent of particular element dynamically.......... in this case... div id=parent ......

Thanks for the info in advance...

regards
Vinothkumar Velusamy

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0f5d05c4-754b-4f4a-a32a-398171648478%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLkOtuvEG05WTtDrOevuUozbCftzX4cW7uuoFmoqtqp4pg%40mail.gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Best Regards,
Vinoth V
Cell:<a href="tel:%2B91-9740-629-246" value="+919740629246" target="_blank">+91-9740-629-246


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAHsdjV3UUHdKRrga%2BgB4Qu5UGB-aw5r6ppDj0ShhA1EL%3Dv3sig%40mail.gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
 
- "If you haven't suffered, you haven't lived your life."
 
Thanks,
 
Sirus

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJJ%2BLvFhqTQKgS6vaHy4FRhzrjjbLdVZoFD5mokjEJnuCdRHng%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Loading...