2

I want to make a script that plays all videos of YouTube channel and perform player settings and return status.

Execution of the following command does not create any error on java stacktrace but, neither has effect on YouTube player.

  • player.nextVideo() (command does not move to next video),
  • player.previousVideo() (command does not move to previous video), and
  • player.setShuffle(true).

Here is a complete script. My code use FlexWebDriver class, described for instance here.

import org.openqa.selenium.firefox.FirefoxDriver;

public class Youtube {

  public static void main(String[] args) throws InterruptedException {

    FirefoxDriver driver = new FirefoxDriver();

    FlexWebDriver flashApp = new FlexWebDriver(driver, "movie_player");

    driver.get("http://www.youtube.com/watch?v=fZUTMprV9dI&list=UUQc_OGfP0IsgOWT0vosmQjg&feature=plpp_play_all");
    Thread.sleep(5000L);

    flashApp.call("nextVideo");
    flashApp.call("previousVideo");
    flashApp.call("setShuffle","true");
  }

}
3
  • 1
    As is, the code starts a FireFox browser and plays a series of YouTube videos. I do not see any error messages. Can you explain what you mean by "perform player settings and give status"? Where do you see the error messages? In a Java stack trace? In the browser? Somewhere else? Which version of Selenium are you using? Which version of FireFox? Which operating system? And finally, what is your question?
    – user246
    Commented Feb 25, 2012 at 23:25
  • I don't get error in Java stack trace. Problem is that Effect of flashApp.call("nextVideo"); / flashApp.call("previousVideo"); / flashApp.call("setShuffle","true"); commands are not appeared on youtube video player. when next video command execute next video should started on youtube player. but this is not happened Commented Feb 26, 2012 at 5:44
  • @Jasmine, I improved formatting a bit for you, so hopefully it can be better understood what your problem is.
    – dzieciou
    Commented Nov 3, 2012 at 16:53

2 Answers 2

4

This happens because FirefoxDriver does not support execution of Flex applications.

4

To test Flex applications you need to use a selenium flex testing framework. There are quite a few available such as FlexUI. You can find out about others at this SQA question: Further Detail On Flex Test Frameworks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.