<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I haven't had to create a test with this specific type of element
before, but from some quick Googlin', it seems that there is no
specific method available via the Selenium API to obtain the width
as a percentage, so the consensus seems to be that you have to
calculate the percentage yourself based on the maximum possible
pixel width (after maximizing the browser window size with something
like <i>@browser.window.maximize</i>) <br>
<br>
- Jeff<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 1/14/14, 11:59 AM, Amir E. Aharoni
wrote:<br>
</div>
<blockquote
cite="mid:CACtNa8sMtZw2x-ygVYw-Lr5OTWVJbMYVJc2soK0mGLxHjWSeQw@mail.gmail.com"
type="cite">
<div dir="rtl">
<div dir="ltr">Hi,<br>
<br>
In the new ContentTranslation extension we have a progress
bar, which is updated using the CSS width property. I wanted
to test that it has the correct value, so I used something
like<br>
progress_bar_element.style("width").should == expected_width<br>
<br>
</div>
<div dir="ltr">Surprisingly, this didn't work: It seems to
return the computed value in px, rather than the specified CSS
value in %.<br>
<br>
</div>
<div dir="ltr">For now I did this like this:<br>
on(ContentTranslationPage).progress_bar_element.attribute("style").should
match(/width: #{width};/)<br>
<br>
</div>
<div dir="ltr">(See <a moz-do-not-send="true"
href="https://gerrit.wikimedia.org/r/#/c/107357/4/tests/browser/features/step_definitions/special_content_translation_steps.rb">https://gerrit.wikimedia.org/r/#/c/107357/4/tests/browser/features/step_definitions/special_content_translation_steps.rb</a>
)<br>
<br>
</div>
<div dir="ltr">Something tells me that there should be a better
way. Can anybody think of anything?<br>
<br>
Thanks!</div>
<div>
<div><br>
--<br>
Amir Elisha Aharoni · אָמִיר אֱלִישָׁע אַהֲרוֹנִי<br>
<a moz-do-not-send="true"
href="http://aharoni.wordpress.com" target="_blank">http://aharoni.wordpress.com</a><br>
“We're living in pieces,<br>
I want to live in peace.” – T. Moore</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
QA mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QA@lists.wikimedia.org">QA@lists.wikimedia.org</a>
<a class="moz-txt-link-freetext" href="https://lists.wikimedia.org/mailman/listinfo/qa">https://lists.wikimedia.org/mailman/listinfo/qa</a>
</pre>
</blockquote>
<br>
</body>
</html>