-1

I tried select video element like:

var selectMyVideo = browser.FindElementsByXPathName("//*[@id='video-container']/div[2]/video");

or

var selectMyVideo = browser.FindElementsByXPathName("//video[contains(@class, 'main-video')]");

But seem it is not working.

There is a structure of element with a root node.

<div id="video-container" platform-type="desktop">
    <div class="mouse-capture">
        <div class="video-container">
            <video preload="true" webkit-playsinline="webkit-playsinline" class="main-video" poster="data:image/gif;base64,R0lSOSlhAQABAIDAAAUEBAYAACwAAAAAAQABCAACAkQBADs=" src="http://myserver.com/media-8.mp4">
            </video>
        </div>
    </div>
</div>

Can anyone help me? Thanks.

joe
  • 67
  • 1
  • 1
  • 7

1 Answers1

0

try following code.

 var driver = new FirefoxDriver();
        driver.Navigate().GoToUrl("you URL");
        WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
        //check if there is any iframe then get that frame and switch on frame using folloiwng code.
        //var frame = wait.Until(ExpectedConditions.ElementExists(By.Id("frame_id"));
        //driver.SwitchTo().Frame(frame);

        //get video tag.
        var vTag = wait.Until(ExpectedConditions.ElementExists(By.TagName("video")));
        var videoSrc = vTag.GetAttribute("src");

if any issue then let me know. Thanks.

Muhammad USman
  • 208
  • 1
  • 6