I see, then yes, Beanshell would be the better option. But be warned that
Beanshell isn't exactly 100% Java syntax, therefore, depending on the exact
Java code you need to run on Beanshell, some of it may have to be tweaked
to run on Beanshell as I've encountered before, regarding sendKeys and
executeScript. I don't know what other WebDriver Java API methods are
affected.

https://groups.google.com/forum/#!topic/webdriver/vlaBV7OO5Hs
http://grokbase.com/t/gg/webdriver/127kf2h8n4/javascript-executor-issues-in-java-beanshell

On Wed, Feb 18, 2015 at 9:05 PM, Bob <[email protected]> wrote:

> Well, the problem is I wanted to use ChromeOptions which is not
> implemented in ChromeDriverConfig, so decided to import Java classes.
> Created StackOverflow question with code examples:
> http://stackoverflow.com/questions/28581029/jmeter-
> webdriver-plugin-mobile-emulation
>
> I think maybe it's better to use pure Java code with Beanshell sampler as
> sebb mentioned.
> On 19/02/15 09:52, David Luu wrote:
>
>> Unless the WebDriver sampler API/design has changed in newer versions and
>> you're using an older version, perhaps you are not using it the correct
>> way, or rather at least not the normal way? Have you tried using it the
>> normal way? As suggested by the tutorial/documentation:
>>
>> http://jmeter-plugins.org/wiki/WebDriverTutorial/
>> http://jmeter-plugins.org/wiki/WebDriverSampler/
>> http://jmeter-plugins.org/wiki/ChromeDriverConfig/
>>
>> It seems for the normal way, you configure ChromeDriverConfig element
>> graphically/manually in JMeter, not from code (although there's no reason
>> not to do it from code). Then you use the WebDriverSampler's object to
>> work
>> with WebDriver, not instantiate your own driver instance. So with the
>> Chrome config defined manually in JMeter GUI, all your code needs to do
>> are
>> things like:
>>
>> var pkg = JavaImporter(org.openqa.selenium)
>> var what = WDS.browser.findElement(pkg.By.id('what'))
>> what.sendKeys(['tyres'])
>>
>> If it fails the normal way, it's a JMeter WebDriver plugin issue. If it
>> just fails in your original code, then it's has to do with how you are
>> calling WebDriver classes, but why go that route if you can take the
>> normal
>> route?
>>
>> On Wed, Feb 18, 2015 at 9:52 AM, Bob <[email protected]> wrote:
>>
>>  I wanted to use with WebDriver sampler, it supports only JavaScript.
>>>
>>> On 18/02/15 18:17, sebb wrote:
>>>
>>>  On 18 February 2015 at 11:52, Bob <[email protected]> wrote:
>>>>
>>>>  Hi,
>>>>>
>>>>> I wanted to convert Selenium Java code to JavaScript make it possible
>>>>> to
>>>>> run
>>>>> with JMeter
>>>>>
>>>>>  Why convert?
>>>>
>>>> The BeanShell sampler runs most Java code.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>>  ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to