Need help in Flash selenium
I m automating a web Application which has flash embedded in it. I m using FlashSelenium for flash part of the application but every time i run the test i get the following error
com.thoughtworks.selenium.Se开发者_JS百科leniumException: ERROR: Threw an exception: this.browserbot.findElement("getInfo").PercentLoaded is not a function
Following is code for my test:-
import org.openqa.selenium.server.SeleniumServer;
import org.testng.annotations.Test;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.FlashSelenium;
import com.thoughtworks.selenium.Selenium;
public class FlashClass extends SeleneseTestCase
{
private Selenium selenium = new DefaultSelenium("localhost", 4444, "*firefox","http://localhost:8080");
private FlashSelenium flashApp;
@Test
public void testflashTest() throws Exception
{
flashApp = new FlashSelenium(selenium,"getInfo");
SeleniumServer server = new SeleniumServer();
server.start();
selenium.start();
selenium.setSpeed("1000");
selenium.open("/web-App/Login.html");
selenium.windowMaximize();
selenium.type("userId", "test");
selenium.type("password", "test");
selenium.click("//input[@value=' Log In ']");
Thread.sleep(10000);
int i=flashApp.PercentLoaded();
System.out.println(i);
}
}
The html code where flash is embedded is:-
Any help in this regard is appreciated.
Looks like this is a known issue according to flash-selenium google project. The recommended work around is to not run in firefox and to instead run in chrome. Or there was another suggestion which was to use swfObject instead of object in the embed tag in the html. The later is the better solution but if you want to quickly make sure it is working just fire up chrome.
精彩评论