JavaScript Executor for sendkey.ENTER

4,958 views
Skip to first unread message

Raju

unread,
May 3, 2012, 3:11:24 PM5/3/12
to Selenium Users
Hello

I have some problems in clicking ENTER KEY in firefox, So i want to
write JAVA script for it. If you know the javaexecutor code for ENTER
key could you please share ?

This is what i want to do. Below line is the actual Selenium line to
click enter key.

webDriver.findElement(by).sendKeys(Keys.ENTER);

Could please let me know how can i simulate the same thru JavaScript
executor ? Something like below (Below sample is for Click )... If
anyone know similar one for ENTER key can you please share ?

WebElement element = webDriver.findElement(by);
((JavascriptExecutor)webDriver).executeScript("arguments[0].click();",
element);

Thanks
Raju

Peter Gale

unread,
May 3, 2012, 3:17:08 PM5/3/12
to seleniu...@googlegroups.com
Surely it is better to execute this through webdriver - why don't you want to do it that way?
 
> Date: Thu, 3 May 2012 12:11:24 -0700
> Subject: [selenium-users] JavaScript Executor for sendkey.ENTER
> From: bhaskar...@gmail.com
> To: seleniu...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com.
> To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
>

Raju

unread,
May 3, 2012, 6:20:58 PM5/3/12
to Selenium Users

I tried, I use WebDriver only. But it is not working, pressing ENTER
key is not working on FireFox-12 ( not sure about other latest
versions ), I am using 12 right now. Other browsers it is working fine
for me. so want to keep JavaScript for FireFox.

I tried other options also except autoIT and JavaScript. AutoIt i am
not interested to try. I would like work on JavaScript in case if it
has something to work out.

Thanks for your response.

Thanks


On May 3, 12:17 pm, Peter Gale <peterjeffreyg...@hotmail.co.uk> wrote:
> Surely it is better to execute this through webdriver - why don't you want to do it that way?
>  > Date: Thu, 3 May 2012 12:11:24 -0700
>
>
>
>
>
>
>
> > Subject: [selenium-users] JavaScript Executor for sendkey.ENTER
> > From: bhaskar.all...@gmail.com

Peter Gale

unread,
May 3, 2012, 6:31:49 PM5/3/12
to seleniu...@googlegroups.com
Selenium Webdriver v2.21 does not support Firefox 12. Downgrade to v11 and disable updates, then try it again with webdriver.

> Date: Thu, 3 May 2012 15:20:58 -0700
> Subject: [selenium-users] Re: JavaScript Executor for sendkey.ENTER
> From: bhaskar...@gmail.com
> To: seleniu...@googlegroups.com

Raju

unread,
May 3, 2012, 7:41:19 PM5/3/12
to Selenium Users
No I do not want to down grade, I want to test my application in all
browsers and versions, as it is a open application, not sure what
people will use and what browsers. so want to face all the challenges
now only.

Any how i will test in 11version as well. Sometimes my application
behaves differently in some browser(or versions), anyhow I have to
test in all browsers and versions. I will figure out some solution.

Thanks a lot.

~Raju

On May 3, 3:31 pm, Peter Gale <peterjeffreyg...@hotmail.co.uk> wrote:
> Selenium Webdriver v2.21 does not support Firefox 12. Downgrade to v11 and disable updates, then try it again with webdriver.
>
>
>
>
>
>
>
> > Date: Thu, 3 May 2012 15:20:58 -0700
> > Subject: [selenium-users] Re: JavaScript Executor for sendkey.ENTER
> > From: bhaskar.all...@gmail.com

PeterJef...@hotmail.co.uk

unread,
May 4, 2012, 3:43:37 AM5/4/12
to Selenium Users
As I said, an others can verify, Firefox 12 is NOT supported by the
latest version of Selenium (v2.21).

If you choose to use Firefox 12 with the current version of Selenium
(v2.21) with Firefox, then you can't expect everything to work and you
can't expect support for any issues you get with it.

I'm sure Selenium v2.22 will be Firefox 12 compatible, but I dare say
Firefox v13 will be out by then.

Raju

unread,
May 4, 2012, 12:36:38 PM5/4/12
to Selenium Users
:) :)

Okie. Thanks alot!!!! I will downgrade and continue testing.

Thanks again.

Bye
~Raju

On May 4, 12:43 am, "PeterJeffreyG...@Hotmail.co.uk"
Reply all
Reply to author
Forward
0 new messages