Re: Possible typecasting problem and anyone use Selenium/WebDriver with Beanshell?
Alexey Zinger <inline_four-/[email protected]> Thu, 16 Aug 2012 17:29:18 -0700 (PDT)
| Newsgroups | gmane.comp.java.beanshell.user |
|---|---|
| Message-ID | <[email protected]> |
The reason this isn't working is because the actual parameter signature for=
JavascriptExecutor.executeScript, as per API, is (String, Object...).=A0 S=
o how many parameters does executeScript take?=A0 From Java 5+ language sta=
ndpoint is that it's a String followed by a variable number of Objects.=A0 =
However, when you compile this down to bytecode, the parameter signature ac=
tually looks like this: (String, Object[]) and that's what Beanshell and an=
ything driven by reflection sees.=A0 To make your code work, you will need =
to revert to Java 4-compatible mode (without reliance on variable parameter=
invocation, which is a compiler-only feature) like this:
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.*;
WebDriver driver =3D new FirefoxDriver();
JavascriptExecutor js =3D (JavascriptExecutor) driver;
js.executeScript("some js here", new Object[0]);
Good luck.
=A0
Alexey
________________________________
From: daluu <[email protected]>
To: beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org =
Sent: Thursday, August 16, 2012 2:35 PM
Subject: Re: [Beanshell-users] Possible typecasting problem and anyone use =
Selenium/WebDriver with Beanshell?
=
Just a follow up, I also tried doing same thing using the latest Beanshell 2
JAR, still same result. So doesn't matter for Beanshell version.
And FYI, issue I'm talking about is for Selenium project:
http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_How_do_I=
_execute_Javascript_directly?
http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/=
JavascriptExecutor.html
--
View this message in context: http://beanshell.2283338.n4.nabble.com/Possib=
le-typecasting-problem-and-anyone-use-Selenium-WebDriver-with-Beanshell-tp4=
650445p4650447.html
Sent from the BeanShell - User mailing list archive at Nabble.com.
---------------------------------------------------------------------------=
---
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and =
threat landscape has changed and how IT managers can respond. Discussions =
will include endpoint security, mobile security and the latest in malware =
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Beanshell-users mailing list
Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/beanshell-users
---------------------------------------------------------------------------=
---
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and =
threat landscape has changed and how IT managers can respond. Discussions =
will include endpoint security, mobile security and the latest in malware =
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/