silhouette hustler
silhouette hustler

Reputation: 1763

Get element size using Selenium with C#

I am trying to check if flash video is minimized or maximized. Tried to do something like this:

var video = Program.Driver.FindElement(By.XPath("//object[contains(@id, 'player_api')]"));

int videoSize = video.Size.Width;

if (videoSize > 1024)
{
     //Do something...
}

But I am getting fixed size of HTML element. Any suggestion?

Upvotes: 1

Views: 5531

Answers (1)

Anton Angelov
Anton Angelov

Reputation: 1713

As far as I can see you can locate the following element:

var video = Program.Driver.FindElement(By.XPath("//*[@id='player_api']/param[6]"));

Then get its value and then find the video sizes in the flash object. You can even deserialize the value to C# object from the JSON. Check the image: http://screencast.com/t/sYu3DYxo6V

Upvotes: 1

Related Questions