Search code examples
c#seleniumkaltura

C# Testing Kaltura player using Selenium


I'm going to do some automated testing of our website which has videos played by the Kaltura player. In one of my test I'm going to change the quality settings of the video. Problem is I got no clue on how to fetch that element that is controlling the quality settings from Selenium.

Can anyone confirm if that's possible using Selenium ? If yes, please enlighten me.

Thanks.


Solution

  • Python bindings but principle is the same though.

    change_quality.py

    from selenium import webdriver
    
    browser = webdriver.Chrome()
    browser.implicitly_wait(10)
    browser.get('http://player.kaltura.com/docs/')
    
    browser.switch_to_frame(browser.find_element_by_css_selector('#kaltura_player_ifp'))
    
    quality_btn = browser.find_element_by_css_selector("button[title='Quality Settings']")
    quality_btn.click()
    
    # old quality
    print browser.find_element_by_css_selector('li[aria-checked=true] > a').text
    
    new_quality  = browser.find_element_by_css_selector("a[title='360P HQ']")
    new_quality.click()
    
    quality_btn.click()
    
    # new quality
    print browser.find_element_by_css_selector('li[aria-checked=true] > a').text
    

    In action:

    In [5]: run change_quality.py
    720P
    360P HQ
    

    Everything is possible! Next time - firstly show what you tried.