how can i make element visible

162 views
Skip to first unread message

tarun mehrotra

unread,
Jun 17, 2013, 11:49:13 AM6/17/13
to seleniu...@googlegroups.com
Hi all,
I am facing a problem on my payment page.when i am automating my page .and i want to type security code by my web driver code it is not working.
when i checked again and after that i found that.it's visibility is hidden.
so can anyone please help me out how i can make that element visible and type into it.

Thanks
Tarun Mehrotra

Mark Collin

unread,
Jun 17, 2013, 1:20:36 PM6/17/13
to seleniu...@googlegroups.com
What would you do manually to make it visible?
> --
> 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 selenium-user...@googlegroups.com.
> To post to this group, send email to seleniu...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/selenium-users/9a459602-0715-4160-bd29-93f33c9f21fc%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

tarun mehrotra

unread,
Jun 17, 2013, 10:14:22 PM6/17/13
to seleniu...@googlegroups.com
Manually it is visible ,when i finding element by xpath pr by id it is showing exception of element not visible.


On Mon, Jun 17, 2013 at 10:50 PM, Mark Collin <mark....@lazeryattack.com> wrote:
What would you do manually to make it visible?



On 17/06/2013 16:49, tarun mehrotra wrote:
Hi all,
I am facing a problem on my payment page.when i am automating my page .and i want to type security code by my web driver code it is not working.
when i checked again and after that i found that.it's visibility is hidden.
so can anyone please help me out how i can make that element visible and type into it.

Thanks
Tarun Mehrotra
--
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 selenium-users+unsubscribe@googlegroups.com.

To post to this group, send email to selenium-users@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/ZbelH7TU15Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/51BF4564.9090802%40lazeryattack.com.

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





--
Thanks&Regards
TarunMehrotra
8952005566

Rocky Wang

unread,
Jun 17, 2013, 10:20:38 PM6/17/13
to seleniu...@googlegroups.com
Yes, I am facing the same problem. One element has attribute display:no. Is there any way to set he attribute directly not manually make it from UI.

Thanks
Rocky

Mark Collin

unread,
Jun 18, 2013, 2:52:19 AM6/18/13
to seleniu...@googlegroups.com

In that case it sounds like you need an explicit wait.  My guess would be that Selenium is going so quickly it’s checking for the element before it has been drawn on your screen, you want to do something like this:

 

WebDriverWait wait = new WebDriverWait(driver, 15, 100);

WebElement myElement = driver.findElement(By.id("myElementID"));

 

From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of tarun mehrotra
Sent: 18 June 2013 03:14
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] how can i make element visible

 

Manually it is visible ,when i finding element by xpath pr by id it is showing exception of element not visible.

On Mon, Jun 17, 2013 at 10:50 PM, Mark Collin <mark....@lazeryattack.com> wrote:

What would you do manually to make it visible?




On 17/06/2013 16:49, tarun mehrotra wrote:

Hi all,
I am facing a problem on my payment page.when i am automating my page .and i want to type security code by my web driver code it is not working.
when i checked again and after that i found that.it's visibility is hidden.
so can anyone please help me out how i can make that element visible and type into it.

Thanks
Tarun Mehrotra
--

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 selenium-user...@googlegroups.com.


To post to this group, send email to seleniu...@googlegroups.com.


--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/ZbelH7TU15Q/unsubscribe.

To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.



 

--
Thanks&Regards
TarunMehrotra
8952005566

--

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 selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJvUF%2BksU3Wh_bFpa9xVj7M0NBJqK-SK7HCHC4ZwMX_f%2BJMG4g%40mail.gmail.com.

tarun mehrotra

unread,
Jun 18, 2013, 5:46:28 AM6/18/13
to seleniu...@googlegroups.com
Hi
Thanks for your reply  Mark
I tried by using this code but if i use this code ia m not able to use send keys method as i need to enter security code.
if i am using sendkeys method it is showing error.

Thanks
Tarun mehrotra


--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/ZbelH7TU15Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

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



--
Thanks&Regards
TarunMehrotra
8952005566

Elangovan Ganesan

unread,
Jun 18, 2013, 6:52:59 AM6/18/13
to Selenium Users
Hi,

Can you please try with this code?,

(new WebDriverWait(driver, 10)).until(ExpectedConditions.visibilityOfElementLocated(locator));

Thanks.

Best Regards,

Elangovan G
QA Automation Engineer
BPA Technologies Pvt Ltd, Chennai



--
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 selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

tarun mehrotra

unread,
Jun 18, 2013, 10:47:38 PM6/18/13
to seleniu...@googlegroups.com
Hi thanks for your reply
I tried this code also but nothing happening .where i put in  this line in my code it just sleep .nothing happen i waited for 10 mins but still its just go on sleep.

Thanks
Tarun Mehrotra



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



--
Thanks&Regards
TarunMehrotra
8952005566

Elangovan Ganesan

unread,
Jun 19, 2013, 12:03:46 AM6/19/13
to Selenium Users
Hi Tarun,

You add this code just before typing into the security code text box. You can increase the waiting time also to the visibility of security code text box.

(new WebDriverWait(driver, 10)).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("xpath of security field")));

or check any java script event is need to be triggered to make the element visible in html source.

Thanks.


Best Regards,

Elangovan G
QA Automation Engineer
BPA Technologies Pvt Ltd, Chennai



Mark Collin

unread,
Jun 19, 2013, 4:09:15 AM6/19/13
to seleniu...@googlegroups.com
That code will *not* make the element visible.  It will just wait until it is visible.

You will need to do whatever you would manually do to make the element visible.

tarunme...@gmail.com

unread,
Jun 19, 2013, 4:11:28 AM6/19/13
to seleniu...@googlegroups.com
Hi,
Manual I don't have to do anything to make it visible it is visible and I can write in that text box.
Sent from BlackBerry® on Airtel

From: Mark Collin <mark....@lazeryattack.com>
Date: Wed, 19 Jun 2013 09:09:15 +0100
Subject: Re: [selenium-users] Re: how can i make element visible
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/51C1672B.4060306%40lazeryattack.com.

Mark Collin

unread,
Jun 19, 2013, 4:23:12 AM6/19/13
to seleniu...@googlegroups.com
If you step through your test in debug mode is it visible?

I think we are going to need to see your code/the web page/a stack trace
to provide any useful help

On 19/06/2013 09:11, tarunme...@gmail.com wrote:
> Hi,
> Manual I don't have to do anything to make it visible it is visible and I can write in that text box.
> Sent from BlackBerry� on Airtel
>
>> Blog: Automatium <http://automatium.blogspot.in/>
>>
>>
>>
>> On Wed, Jun 19, 2013 at 8:17 AM, tarun mehrotra
>> <tarunme...@gmail.com <mailto:tarunme...@gmail.com>> wrote:
>>
>> Hi thanks for your reply
>> I tried this code also but nothing happening .where i put in this
>> line in my code it just sleep .nothing happen i waited for 10 mins
>> but still its just go on sleep.
>>
>> Thanks
>> Tarun Mehrotra
>>
>>
>> On Tue, Jun 18, 2013 at 4:22 PM, Elangovan Ganesan
>> <golag...@gmail.com <mailto:golag...@gmail.com>> wrote:
>>
>> Hi,
>>
>> Can you please try with this code?,
>>
>> (new WebDriverWait(driver,
>> 10)).until(ExpectedConditions.visibilityOfElementLocated(locator));
>>
>> Thanks.
>>
>> Best Regards,
>>
>> Elangovan G
>> QA Automation Engineer
>> BPA Technologies Pvt Ltd, Chennai
>> Mob: (+91) 9894141621
>> Blog: Automatium <http://automatium.blogspot.in/>
>>
>>
>>
>> On Tue, Jun 18, 2013 at 3:16 PM, tarun mehrotra
>> <tarunme...@gmail.com <mailto:tarunme...@gmail.com>>

tarun mehrotra

unread,
Jun 19, 2013, 5:02:33 AM6/19/13
to seleniu...@googlegroups.com
Hi,
This is the code when i inspect the element 
<input id="ctl21_SecurityCode" class="addTxtNew" type="password" style="width:100px;" autocomplete="Off" tabindex="14" maxlength="4" name="ctl21$SecurityCode">



         wrote:

             Hi
             Thanks for your reply  Mark
             I tried by using this code but if i use this code ia m not
             able to use send keys method as i need to enter security code
--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/ZbelH7TU15Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/51C16A70.8010902%40lazeryattack.com.

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





--
Thanks&Regards
TarunMehrotra
8952005566

hari prasad

unread,
Jun 19, 2013, 5:27:19 AM6/19/13
to seleniu...@googlegroups.com
Try to do the action using java script by using javascript executor.

Mark Collin

unread,
Jun 19, 2013, 10:16:45 AM6/19/13
to seleniu...@googlegroups.com
Looks like I was in a different world when I wrote this.  The code snippet should have been:


WebDriverWait wait = new WebDriverWait(driver, 15, 100);
WebElement myElement = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("myElement")));



On 18/06/2013 07:52, Mark Collin wrote:

In that case it sounds like you need an explicit wait.  My guess would be that Selenium is going so quickly it’s checking for the element before it has been drawn on your screen, you want to do something like this:

 

WebDriverWait wait = new WebDriverWait(driver, 15, 100);

WebElement myElement = driver.findElement(By.id("myElementID"));

 


Sent: 18 June 2013 03:14
To: seleniu...@googlegroups.com

Subject: Re: [selenium-users] how can i make element visible

 

Manually it is visible ,when i finding element by xpath pr by id it is showing exception of element not visible.

On Mon, Jun 17, 2013 at 10:50 PM, Mark Collin <mark....@lazeryattack.com> wrote:

What would you do manually to make it visible?




On 17/06/2013 16:49, tarun mehrotra wrote:

Hi all,
I am facing a problem on my payment page.when i am automating my page .and i want to type security code by my web driver code it is not working.
when i checked again and after that i found that.it's visibility is hidden.
so can anyone please help me out how i can make that element visible and type into it.

Thanks
Tarun Mehrotra
--

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 selenium-user...@googlegroups.com.


To post to this group, send email to seleniu...@googlegroups.com.


--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/ZbelH7TU15Q/unsubscribe.

To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.



 

--
Thanks&Regards
TarunMehrotra
8952005566

--

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 selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJvUF%2BksU3Wh_bFpa9xVj7M0NBJqK-SK7HCHC4ZwMX_f%2BJMG4g%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages