Selenium returning the hidden element as visible, clickable and enabled when element is hidden & not

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Selenium returning the hidden element as visible, clickable and enabled when element is hidden & not

Nagarjuna Reddy

I want to open the filters only if they are not already open. For that, I'm checking if "Apply Filter" button is visible/clickable.

To my surprise, I'm getting the element as visible/clickable even though it is not.

Button code mentioned below,


<div class="m-t-20 text-left filter-btn-holder ">
   <input type="hidden" id="filterType" value="">
   <button type="button" class="submit btn btn-primary btn-mini filter-focus" id="filterButton" onclick="javascript:getFilteredMedia(true);" "="">Filter</button>
   <button type="button" class="submit btn btn-danger btn-mini" id="filterButton" onclick="clearFilter();">Reset</button>
   <button type="button" class="submit btn btn-mini" data-webarch="toggle-right-side" id="closeButton"><i class="fa fa-times" aria-hidden="true"></i></button>
</div>


Method trying to check if the element is clickable

public boolean isClickable(WebElement el) 
    {
        try{
            WebDriverWait wait = new WebDriverWait(driver, 6);
            wait.until(ExpectedConditions.elementToBeClickable(el));
            return true;
        }
        catch (Exception e){
            return false;
        }
    }

XPath of the button: xpath = "//button[@id='filterButton' and text()[contains(.,'Filter')]]


https://stackoverflow.com/questions/51136790/selenium-returning-the-hidden-element-as-visible-clickable-and-enabled-when-ele/51154716#51154716

--
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/90806e52-c7b9-43b8-bec3-4265a8ff76e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Screen Shot 2018-07-04 at 11.15.33 PM.png (266K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Selenium returning the hidden element as visible, clickable and enabled when element is hidden & not

Dinesh Kumar R-"The Developer in Test"
Hi Nagarjuna Reddy -

If you could observe the preceding <input> tag contains type='hidden' as value. May be if you could just modified your xpath it may do.

Like xpath may be :  //input[not(contains(@type,'hidden'))]/following-sibling::button[@id='filterButton' and text()[contains(.,'Filter')]

Let me know if this had helped.

--Regards
Dinesh Kumar R 
Developer in Test

--
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/b56007eb-463d-46e0-ad0a-93221073bae3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Selenium returning the hidden element as visible, clickable and enabled when element is hidden & not

senthiljune2
In reply to this post by Nagarjuna Reddy
Hi Naga,

How to automate Google map Geo Tag?
my scenarios
Page displayed Google map with Geo Tag,I want to Select any one of the Geo Tag by using Mouse how to Automate pls hep

On Thursday, July 5, 2018 at 2:37:22 AM UTC+5:30, Nagarjuna Reddy wrote:

I want to open the filters only if they are not already open. For that, I'm checking if "Apply Filter" button is visible/clickable.

To my surprise, I'm getting the element as visible/clickable even though it is not.

Button code mentioned below,


<div class="m-t-20 text-left filter-btn-holder ">
   <input type="hidden" id="filterType" value="">
   <button type="button" class="submit btn btn-primary btn-mini filter-focus" id="filterButton" onclick="javascript:getFilteredMedia(true);" "="">Filter</button>
   <button type="button" class="submit btn btn-danger btn-mini" id="filterButton" onclick="clearFilter();">Reset</button>
   <button type="button" class="submit btn btn-mini" data-webarch="toggle-right-side" id="closeButton"><i class="fa fa-times" aria-hidden="true"></i></button>
</div>


Method trying to check if the element is clickable

public boolean isClickable(WebElement el) 
    {
        try{
            WebDriverWait wait = new WebDriverWait(driver, 6);
            wait.until(ExpectedConditions.elementToBeClickable(el));
            return true;
        }
        catch (Exception e){
            return false;
        }
    }

XPath of the button: xpath = "//button[@id='filterButton' and text()[contains(.,'Filter')]]


<a href="https://stackoverflow.com/questions/51136790/selenium-returning-the-hidden-element-as-visible-clickable-and-enabled-when-ele/51154716#51154716" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F51136790%2Fselenium-returning-the-hidden-element-as-visible-clickable-and-enabled-when-ele%2F51154716%2351154716\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE3r4G_1aL8QJRoF9fEcM6KkL6wQA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F51136790%2Fselenium-returning-the-hidden-element-as-visible-clickable-and-enabled-when-ele%2F51154716%2351154716\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE3r4G_1aL8QJRoF9fEcM6KkL6wQA&#39;;return true;">https://stackoverflow.com/questions/51136790/selenium-returning-the-hidden-element-as-visible-clickable-and-enabled-when-ele/51154716#51154716

--
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/74bc1cae-3447-4d02-b0cf-055c71654c68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.