Hi I'm making a christmas card with HTML I must use background image in order to avoid spam. However my background image does not appear in Outlook. Can you please fix this? P.S. I don`t know a thing about html I learn everything right now.
</table>
<table width="706" height="462" border="7"; bordercolor="#c89c53" align="center">
<tr>
<td background="http://ch-eu.com/dev/files/32.jpg" bgcolor="#7bceeb" width="636" height="92" valign="top">
</table>
I've been testing in Selenium IDE. It's pretty easy to use, and I have created some test cases with it. I've been searching Google, trying to find a way to repeat my tests automatically. I've seen a solution with gotolabel, while loops, etc. But I couldn't make any of them works. Can someone give me a tip on how to loop my test n times, or loop forever. I appreciate any help.
No need to install/download anything, the built-in times command does this very easily:
Insert a new line at the beginning of your script, select times as its Command and 10 (for instance) as its Target.
Scroll down to the bottom of your script, and add a new line with end as its command
Press the "Run" button as usual.
Your commands are executed 10 times.
In this example I click on a button 2000 times:
To loop forever, just replace 10 with an extremely large number, that will take centuries to execute, which probably is as good as forever if you are running Selenium IDE.
Do this:
Download this js file: https://github.com/darrenderidder/sideflow/blob/master/sideflow.js
Launch Selenium IDE from Firefox and open the options menu.
Upload the .js file to the "Selenium Core extensions (user-extensions.js)" field.
The js file provides goto, gotoIf and while loop functionality in Selenium IDE. The example below shows a simple loop:
<tr>
<td>getEval</td>
<td>index = 0;</td>
<td></td>
</tr>
<tr>
<td>while</td>
<td>index < 10;</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>index</td>
<td>value</td>
</tr>
<tr>
<td>echo</td>
<td>${value}</td>
<td></td>
</tr>
<tr>
<td>getEval</td>
<td>index++;</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
as stated in the answer above, install the user extension, which will add loop functionality to Selenium IDE tests. The example below shows a simple loop:
<tr>
<td>getEval</td>
<td>index = 0;</td>
<td></td>
</tr>
<tr>
<td>while</td>
<td>index < 10;</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>index</td>
<td>value</td>
</tr>
<tr>
<td>echo</td>
<td>${value}</td>
<td></td>
</tr>
<tr>
<td>getEval</td>
<td>index++;</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
I'm new to Selenium (just started using it a few minutes ago). After a quick Google search for "selenium loop" this stackoverflow.com question came up. I immediately jumped into the extension and started using loops. The accepted answer is very helpful. However, I wanted to point out something else for others that are new to selenium (and stumble on this page).
I created a simple test for a simple web page. I added a loop so that the test would run indefinitely (until I paused/stopped it). However, I noticed that by doing this, the Runs/Failures counters within the Selenium GUI do not increment with each loop (I am guessing because a single test case was never running to completion, it was just looping indefinitely). So I dug a bit further. My goal was to leave the same test running for a long time (a few hours, or possibly overnight) to see if there were any failures (I'm chasing an intermittent bug at the moment).
The simplest way (for me, after a few minutes of searching/experimenting) was to do the following (likely no plugins needed, although the attached plugin is definitely helpful if you want to run a few small loops within a test case):
save the test case to a text file
save the test suite to a text file
open the test suite text file in a text editor
copy and paste the test case multiple times within the test suite (for example, a thousand times)
then open the test suite in Selenium, and run the test suite
Now I have the same simple test suite running many times, and the Runs/Failures counters are incrementing as expected (without the need for any loops).
Use the Flow Control plug-in for Firefox. After restarting Firefox, use the label command to mark a point in the script, and the gotolabel command to jump there.
For example:
Or if you'd rather see the source code, this is a label:
<tr>
<td>label</td>
<td>start</td>
<td></td>
</tr>
And this causes the execution point to jump back to the label:
<tr>
<td>gotolabel</td>
<td>start</td>
<td></td>
</tr>
There are other commands that you can see on the plug-in page, and documented in the
Selenium IDE: Flow Control GitHub project.
Selenium IDE now has flow control. These Control Flow commands work by specifying opening and closing commands to denote a set (or block) of commands.
Available Commands
Here are each of the available control flow commands accompanied by their companion and/or closing commands.
if, else if, else, end
times, end
do, repeat if
while, end
You can read more about it here:
https://www.seleniumhq.org/selenium-ide/docs/en/introduction/control-flow/
This is a sample for sampcop user in order to automate spam complaints using label and goto Label commands:
1st Login on spamcop.net
2nd use Report Spam option
3rd start this script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://www.spamcop.net/sc" />
<title>testecase</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">testecase</td></tr>
</thead><tbody>
<tr>
<td>label</td>
<td>target1</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Report Now</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[#value='Send Spam Report(s) Now']</td>
<td></td>
</tr>
<tr>
<td>gotoLabel</td>
<td>target1</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
Your test suite file is just an HTML file, so just do the following:
<tr><td>testCase1</td></tr>
<tr><td>sameStep</td></tr>
<tr><td>testCase1</td></tr>
<tr><td>sameStep</td></tr>
Since I have installed the mvc4 RC, the razor autoresolve url that replaces ~ by the application root does not work in html 5 data-* attributes. ie:
In ASP.NET MVC4 beta :
<table id="userTable" class="dataTable" data-table-source="~/api/user/Users">
<tr>
<td data-field="OperatorCode">
#user.Code
</td>
<td>
edit
</td>
</table>
was transformed in
<table id="userTable" class="dataTable" data-table-source="/api/user/Users">
<tr>
<td data-field="OperatorCode">
operatorCode 1
</td>
<td>
edit
</td>
</table>
but in RC it is transformed in:
<table id="userTable" class="dataTable" data-table-source="~/api/user/Users">
<tr>
<td data-field="OperatorCode">
operatorCode 1
</td>
<td>
edit
</td>
</table>
As you can see in this version the ~ remains.
Is it by design ? If yes, is there any configuration parameter to change in order to reactivate the resolution in html5 data-* attribute? I have no found the explanation in the release notes.
Thank you.
This also happens in MVC4 final. It makes sense that this is by design to avoid cases where you don't want to have "~" resolved for certain data parameters.
Easy fix is to wrap them in #Url.Content again, not as nice but it works.
<html data-root="#Url.Content("~/")">
PS. I checked the MVC4 source code. There are no options to enable resolving of "data-" attributes. "data-" attributes are simply treated as literals.
could anybody give me a good idea or hint (not a tool) how I could implement a JDBC meta data based automatic generation of html forms?
I have solved this before in a Java standalone program - now I want to expand the idea within html.
I do NOT want to use Spring, Wicket or JSF to solve the problem, I want to do it myown to learn from scratch.
I have searched really a lot, I found a lot of stuff, but nothing which could answer my question. But I am sure this problem has been solved in the past a dozen times.
Thank you
Alex
Create a servlet class, let it call your "Java standalone program" in the doGet() method, get the desired data in form of some List<Row> from it, put it in the request scope and forward the request to JSP
List<Row> rows = yourProgram.list();
request.setAttribute("rows", rows);
request.getRequestDispatcher("/WEB-INF/list.jsp").forward(request, response);
And finally in /WEB-INF/list.jsp use the JSTL c:forEach to display it.
<%#taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%#taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
...
<table>
<tr>
<c:forEach items="${rows[0].columns}" var="column">
<th><c:out value="${column.name}" /></th>
</c:forEach>
</tr>
<c:forEach items="${rows}" var="row">
<tr>
<c:forEach items="${row.columns}" var="column">
<td><input type="text" name="${fn:escapeXml(column.name)}" value="${fn:escapeXml(column.value)}" /></td>
</c:ForEach>
</tr>
</c:forEach>
</table>
Let it submit to a servlet by <form method="post"> and gather the data in doPost() method.
I'm creating PDFs on-demand with ColdFusion's CFDocument tag, like so:
<cfdocument format="PDF" filename="#attributes.fileName#" overwrite="true">
<cfdocumentitem type="footer">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left"><font face="Tahoma" color="black"><strong>My Client's Corporation</strong><br/>Street address<br/>City, ST 55555</font></td>
<td align="right"><font face="Tahoma" color="black">Phone: 555.555.5555<br/>Fax: 555.555.5555<br/>Email: info#domain.com</font></td>
</tr>
</table>
</cfdocumentitem>
<html>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<!--- some content here ... --->
</table>
</body>
</html>
</cfdocument>
The problem I'm having is that sometimes (actually, most of the time, but not always) some of the footer text is there, but invisible. I can highlight it and copy/paste it into notepad, where I can see it all -- but in the generated PDF only the first line of the left column of the footer is visible, the rest is invisible. Hence why I added the font color of black in the code.
Any ideas on how to correct this?
A PDF is what I'm after, so I'm not sure how outputting another format would help.
As it turns out, the footer space just wasn't enough to fit all of this text; verified by the fact that changing the font size to 4pt would fit it all in without a problem.
I spent some time attempting to rewrite the footer code using DDX as outlined here and the CFPDF tag to implement it; but even after several hours of hacking away and finally getting a valid DDX as reported by the new isDDX function, the CFPDF tag reported that it was invalid DDX for some reason.
At this point I decided I had wasted enough of the client's time/money and just reformatted the footer to be 2 lines of centered text, which was good enough.
Usually when PDF shows blank text, it's because the font metrics are embedded in the document, but the glyphs are not. I know nothing about ColdFusion, but you might try the following:
Try a font other than Tahoma as a test. All PDF readers must support 14 basic fonts, including 4 Helvetica variants, 4 Times variants, 4 Courier variants, Symbol and ZapfDingbats, so those are always safe choices
See if ColdFusion offers any control over font embedding
Try a list of alternatives in your font declaration, like "Tahoma,Helvetica,sans-serif"