selenium ide screenshot save fail - save

I need to be able to take a screenshot of a webpage and save it to a folder on my hard-drive. To do this I tried to use the captureEntirePageScreenshot, setting the folder I was to use as the target.
<tr>
<td>captureEntirePageScreenshot</td>
<td>C:\Users\.....\Desktop\test</td>
<td></td>
</tr>
I get the following error when I tell it to execute. Note: the base URL on selenium and the webpage match.
[error] Unexpected Exception: [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFileOutputStream.init]" nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)" location: "JS frame :: chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js :: <TOP_LEVEL> :: line 2986" data: no]. QueryInterface -> function QueryInterface() { [native code] }, message -> Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFileOutputStream.init], result -> 2152857621, name -> NS_ERROR_FILE_ACCESS_DENIED, filename -> chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js, lineNumber -> 2986, columnNumber -> 0, location -> JS frame :: chrome://selenium-ide/content/selenium-core/scripts/selenium-api.js :: <TOP_LEVEL> :: line 2986, inner -> null, data -> null, initialize -> function initialize() { [native code] }
If anyone can help me make sense of this and solve it, I would greatly appreciate it.

Try this and let me know if it work for you or not because it work fine for me
<tr>
<td>open</td>
<td>http://docs.seleniumhq.org/download/</td>
<td></td>
</tr>
<tr>
<td>captureEntirePageScreenshot</td>
<td>d:/title.png</td>
<td></td>
</tr>

Hmm, I'm using Selenium 2.2.0, but am on Firefox 17.0.1, and the command below works for me.
captureEntirePageScreenshot | c:\selenium\test.jpg |
Note that it works with or without the file extension. You might want to check with seleniumhq.org to see if there's a reported issue with that command in Firefox 22.
Klendathu

Try doubling the back slashes from \ to \\ in the file path.
<tr>
<td>captureEntirePageScreenshot</td>
<td>C:\\Users\\.....\\Desktop\\test</td>
<td></td>
</tr>
Hope that helps.

Related

How can I get Ractive.js to cooperate with Slim templates?

The Ractive tutorial uses this:
<th class='sortable {{ sortColumn === "name" ? "sorted" : "" }}'
on-tap='sort:name'>
Superhero name
</th>
The project I am working on uses Slim. Using html2slim, I am provided with this syntax:
th.sortable.sortColumn.: class=("{{ === \"name\" ? \"sorted\" \"\" }}") on-tap="sort:name"
Superhero name
I don't know if that is valid Slim syntax; I cannot find anything in the Slim documentation to guide me. So I'm lost as to how this should be formatted in Slim, to render properly for Ractive.
The above syntax results in:
syntax error, unexpected tIDENTIFIER, expecting keyword_end
I have searched for gems, SO answers, and broad Googling but cannot find any clues. Has anyone here successfully done something like this?
In slim, use a double equal == to disable escaping in the attribute, see https://github.com/slim-template/slim#quoted-attributes
I believe you can also mix ' and "" to avoid back-slashing, and I think you need to include the data ref in the mustache. The : inline a child element, so you don't want that either. Lastly, I'm not sure you can mix .classname notation with an explicit attribute. So I think it ends up being:
th class=="sortable {{ sortColumn === 'name' ? 'sorted' : '' }}" on-tap="sort:name"
Superhero name

Accessing a for loop variable inside and if statement

I have the following code but it gives me an error. Can anyone help?
<span th:each="p,iter : ${pp}">
<span th:text="${p.title}">[default]</span>
<span
th:if="${#lists.size(hh) >= iter.index
th:text="${hh[iter.index].name}">
</span>
...
I get this error message:
Error during execution of processor org.thymeleaf.standard.processor.attr.StandardIfAttrProcessor'
It is because of the list.size(hh) >= iterStat.index. If I don't have the iterStat.index then it is ok. But as this is dynamic I want to use the index of the iteration.
Is this possible?
You have a missing } in th:if="${#lists.size(hh) >= iter.index

Capybara - assert_selector("tr#1234") doesn't work, but find_by_id(1234) does

What are possible reasons that doing page.find_by_id(id) works, but doing page.assert_selector("tr##{id}") returns aCapybara::ElementNotFound`?
For background, I am using the Poltergeist driver for Capybara.
I have HTML that is structured like so:
<tbody>
<tr id="1234">
<td>Rico Jones</td>
<td>Price Request</td>
</tr>
<tr id="2345">
<td>Rico Jones</td>
<td>Price Request</td>
</tr>
</tbody>
I have confirmed that my HTML is coming out as expected by using the page.driver.debug feature of Poltergeist and looking at the actual HTML generated by the test.
When I put something like this in my tests, I get a Capybara::Poltergeist::InvalidSelector error with the message The browser raised a syntax error while trying to evaluate the selector.
lead = Lead.first
assert_selector "tr##{lead.id}"
I also get an error when doing this:
lead = Lead.first
within "tr##{lead.id}" do
click_on "Price Request"
end
However, using find_by_id works:
lead = Lead.first
find_by_id(lead.id).click_on("Price Request")
Based on my understanding of Capybara, this shouldn't be the case. Am I doing something wrong?
This is because ID's should not begin with numbers, as shown here.
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
followed by any number of letters, digits ([0-9]), hyphens ("-"),
underscores ("_"), colons (":"), and periods (".").

Compile dust template with line breaks

Compiling a such template with dustc:
$ cat <<EOF | ./node_modules/.bin/dustc -
<p>Hi there!</p>
<p>I'm a {! dust !} template.</p>
EOF
outputs:
(function(){dust.register("-",body_0);function body_0(chk,ctx){return chk.write("<p>Hi there!</p><p>I'm a template.</p>");}return body_0;})();
but without \n between lines, eg: "<p>Hi there!</p>\n<p>I'm a template.</p>"
Is there any way to change this?
Thank you
You can use {~n} to create line breaks in your Dust templates. It's is especially useful within <pre> tags.
You can disable whitespace compression with
dust.optimizers.format = function(ctx, node) { return node };
Precompiling with gulp-dust, there's a preserveWhitespace option that does just that:
var compile=require('gulp-dust');
// ...
gulp.src('templates/**/*.dust')
.pipe(compile({ preserveWhitespace: true }))
// ...

Invalid Variant Operation error

I have an error in my button click, and I can't figure out how to resolve it.
This is my code:
if (ovElements.item(i).name = 'add') and
(ovElements.item(i).type = 'button') and
(ovElements.item(i).Value = ' + ') then
ovElements.item(i).Click;
This is the markup:
<td width="20" align="left"><input class="button" style="width: 30px;"
name="add" value=" + " onclick="addLvl();" type="button"></td>
And it gives this error:
Invalid Variant Operation Error
What did I do wrong?
Just a guess:
ovElements.item(i).Value is probably a Variant. If a variant contains a null value you will get that error when you compare it to a string.
Make sure ovElements.item(i) doesn't contain a null value before comparing it.
You can save "ovElements.item(i)" to a local variable and then split your code into multiple line.
obj = ovElements.item(i);
if obj <> nil then
try
if obj.name = 'add' then
if obj.type = 'button' then
if obj.value = ' + ' then
obj.click;
except
end;
In this way you can see which line causes this problem.
It means an operation on a variant which is executed is invalid. This happens, for example, when a variant containing some text is divided by an integer. Clearly this cannot work, but since the compiler can't check this, it is a runtime error.
Use a temporary variable for the 3 parts in your if statement to see better on which line the error is raised. Then inspect what the values are and what the invalid operation is.

Resources