Discussion:
Execute console commands in Firefox using Selenium Webdriver
Essdee
2013-10-11 10:33:42 UTC
Permalink
Hi Guys,

I was trying to retrieve values automatically from the browser. I noticed I
can get those values from the console by typing commands.

Could you please help and guide me to execute the commands in FF console
(currently using Firebug) using Selenium webdriver.

<Loading Image...>












My command is something like the below:
s.evarx

I want to execute the above command and retrieve that value using selenium.
Is there a command that will help to achieve this?

Need your help guys...

Thanks in advance...
Essdee
--
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/770bf31e-6125-4f55-939c-2984c32448e0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
skonthebass
2013-10-11 13:57:41 UTC
Permalink
Post by Essdee
Hi Guys,
I was trying to retrieve values automatically from the browser. I noticed
I can get those values from the console by typing commands.
Could you please help and guide me to execute the commands in FF console
(currently using Firebug) using Selenium webdriver.
<https://lh5.googleusercontent.com/-FO9X4QWX11k/UlfTVN25SNI/AAAAAAAAAAs/awzhSCGpefk/s1600/selenium.JPG>
s.evarx
I want to execute the above command and retrieve that value using
selenium. Is there a command that will help to achieve this?
Need your help guys...
Thanks in advance...
Essdee
--
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/75429e37-9cb9-4148-b85f-135b2e169411%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
David
2013-10-14 18:55:58 UTC
Permalink
You could do something like:

((JavascriptExecutor) driver).executeScript("return s.evarx;");

simply replace "return s.evarx;" with whatever javascript you execute in
the Firebug console that you want to do with WebDriver. Most of the code
you want can be executed this way, but not all.

Be sure to add a "return" keyword to the javascript code to execute if you
are expecting to get the result/data. Otherwise, no need to if you are just
executing code to do something.

An example that isn't helpful when executed via Selenium:
"console.log('something to log');" unless you actually extract and deal
with Firefox logs via Selenium, a separate topic.
Post by Essdee
Hi Guys,
I was trying to retrieve values automatically from the browser. I noticed
I can get those values from the console by typing commands.
Could you please help and guide me to execute the commands in FF console
(currently using Firebug) using Selenium webdriver.
<https://lh5.googleusercontent.com/-FO9X4QWX11k/UlfTVN25SNI/AAAAAAAAAAs/awzhSCGpefk/s1600/selenium.JPG>
s.evarx
I want to execute the above command and retrieve that value using
selenium. Is there a command that will help to achieve this?
Need your help guys...
Thanks in advance...
Essdee
--
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to selenium-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/48986337-56c0-4cf2-96eb-710c91d3a33a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...