Hi ,
Sorry to post this.
I have one issue in Flash using webdrive for 'Select a cobobox'
I wrote a code to identify a select box and select some operation in that dropdon box as below. Please help to fix this issue.
This below sample code is bot working in Flash using webdriver.
Type-1
public void select(String locator, String value) {
((JavascriptExecutor) webDriver).executeScript("document.getElementById('" + flashObjectId + "').fp_select({" + locator +", 'label':'"+ value +"'})");
}
Type-2 : This is also not working.
public String selectByLabled(final String objectId ,final String optionalButtonLabel) {
return call("
doFlexSelectComboByLabel", objectId,optionalButtonLabel);
/*
I have tryied with defferenct function names like below but no luck
doFlexSelectIndex
getFlexSelectedItemAtIndex
doFlexSelect
*/
}
But Click Works Fine sample code like bellow.
public String click(final String objectId, final String optionalButtonLabel) {
return call("doFlexClick", objectId, optionalButtonLabel);
}
...
private String call(final String functionName, final String... args) {
final Object result =
((JavascriptExecutor)webDriver).executeScript(
makeJsFunction(functionName, args),
new Object[0]);
return result != null ? result.toString() : null;
}
private String makeJsFunction(final String functionName, final String... args)
{
final StringBuffer functionArgs = new StringBuffer();
if (args.length > 0) {
for (int i = 0; i < args.length; i++) {
if (i > 0) {
functionArgs.append(",");
}
functionArgs.append(String.format("'%1$s'", args[i]));
System.out.println("functionArgs: "+functionArgs);
}
}
return String.format(
"return document.%1$s.%2$s(%3$s);",
flashObjectId,
functionName,
functionArgs);
}
Thanks,
Gopal