Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Jubula » Tables HTML Toolkit(How to specify cell coordinates?)
icon5.gif  Tables HTML Toolkit [message #1060835] Tue, 28 May 2013 10:55 Go to next message
Joaquin Morcate is currently offline Joaquin Morcate
Messages: 49
Registered: March 2010
Member
Hi all!

I'm trying to check the text in cell in HTML table. This is the HTML code of that displays the table:
<? include("langsettings.php"); ?>
<html>
<head>
<title>Phone Book HTML</title>
<link href="phonebook.css" rel="stylesheet" type="text/css">
</head>

<body>

&nbsp;<p>
<!-- Title displayed in the web page -->
<h1>PHONE BOOK</h1>
<?
    // Create (connect to) SQLite database in file
    $file_db = new PDO('sqlite:contacts.sqlite3');
    // Set errormode to exceptions
    $file_db->setAttribute(PDO::ATTR_ERRMODE, 
                            PDO::ERRMODE_EXCEPTION);

?>

<!-- form section -->
<form action=phonebook.php?action=add& method=post>
<center>
<table border=0 cellpadding=0 cellspacing=3>
    <!-- This is the first row of the form diplaying name and phone -->
    <tr>
        <td>Name</td><td><input type=text size=20 name=name></td>
        <td>Phone</td><td><input testid="phone3" name="phone2" type=text size=20 name=phone></td>
    </tr>
    <!-- This is the second row of the form diplaying first name and photograph -->
    <tr>
        <td>First Name</td><td> <input type=text size=20 name=firstName></td>
        <td>Photograph</td><td> <input type=text size=20 name=photo></td>
    </tr>
    <!-- Third row of the form displaying the button -->
    <tr>
        <td  colspan=4> <input onclick="return error('KK')" class="tabbutton" type=submit border=0 value="SAVE NEW CONTACT" ></td>
    </tr>
</table>
</center>
</form>


<center>
<table name="Contactos" testid="Contactos" border=0 cellpadding=0 cellspacing=0>

<?
	$DO_YOU_WANT_TO_DELETE = "Do you want to delete ";
	$FROM_YOUR_CONTACTS_LIST = " from your contacts list?";

	$ERROR_MSG_NO_PHONE = "Please provide phone Number";
	$ERROR_MSG_NO_NAME = "Please provide name";
	$ERROR_MSG_NO_FIRST_NAME = "Please provide first name";

	$action=@$_REQUEST['action'];
	$firstname=@$_REQUEST['firstName'];
	$name=@$_REQUEST['name'];
	$phone=@$_REQUEST['phone'];
	$photo=@$_REQUEST['photo'];

	if($action=="add")
	{
		if ($photo=="") {
			$photo="resources/no_image.png";
		}
		if ($firstname=="") {
			echo "<script language='JavaScript'>
				alert(\"$ERROR_MSG_NO_FIRST_NAME\");
				
			</script>";
		} else if ($name=="") {
			echo "<script language='JavaScript'>
				alert(\"$ERROR_MSG_NO_NAME\");
				
			</script>";
		} else if ($phone=="") {
			echo "<script language='JavaScript'>
				alert(\"$ERROR_MSG_NO_PHONE\");
				
			</script>";
		} else {
		    $file_db->query("INSERT INTO contacts (name, firstName, phone, photograph) VALUES('$name','$firstname','$phone','$photo')");
		}
	}


	if(@$_REQUEST['action']=="del")
	{
		$file_db->query("DELETE FROM contacts WHERE contact=".round($_REQUEST['id']));
	}



	$result=$file_db->query("SELECT 
                            contact,firstName, name, phone, photograph 
                            FROM contacts ORDER BY name");
	

	foreach($result as $row) {
		echo "<tr>";
		echo "<td class=tabphoto><img src=".$row['photograph']." width=100 height=100></td>";
		echo "<td class=tabval>".$row['firstName']."&nbsp;".$row['name']."</td>";
		echo "<td class=tabval><img class='textmiddle' src='resources/telephone25.png' width='25' height='25'>".$row['phone']."&nbsp;</td>";
		echo "<td class=tabval><a onclick=\"return confirm('".$DO_YOU_WANT_TO_DELETE.$row['firstName']." ".$name.$row['name'].$FROM_YOUR_CONTACTS_LIST."');\" href=phonebook.php?action=del&id=".$row['contact']."> <img class='textmiddle' src='resources/trash30.png' width='25' height='25'></a></td>";
 		echo "</tr>";
         }

	$file_db = null;

?>

</table>
</center>
</body>
</html>


I don't manage to check the contents of the cells. I use a Check Text(Specify Cell) and for the second column (displaying the full name) I enter 2 for the Column attribute. I think that I'm not specifying the row/column well because the test always fails independently if I set "equals" or "not equals" for the Text Operator. From the documentation I understand that you can enter the column/row indexes but the parameter is marked as String.

Any idea what I'm doing wrong? Thank you

Joaquin Morcate
Re: Tables HTML Toolkit [message #1060952 is a reply to message #1060835] Wed, 29 May 2013 05:36 Go to previous messageGo to next message
Joaquin Morcate is currently offline Joaquin Morcate
Messages: 49
Registered: March 2010
Member
Some more information ....

If I enter just a number in the properties view for the test step (let's say for Row[String] I enter 1 I got an Action Error with message Invalid Index. If I enter "1" (i.e. using quotation marks) I got another Action Error but with message "Not Found". If I modify the code to add headers and use the header string (Name or "Name") I got the same error Action Error - "Not Found". It's not that I'm using a wrong column or row numbers because I got the same error for all combination and I've tried a few.

Has anyone tried to check the contents of a table in a HTML page? Does it work at all?

I have seen more than 7000 thousand visits to the post but not a single answer. Sad
Re: Tables HTML Toolkit [message #1061124 is a reply to message #1060952] Thu, 30 May 2013 03:21 Go to previous messageGo to next message
Alexandra Schladebeck is currently offline Alexandra Schladebeck
Messages: 1055
Registered: July 2009
Senior Member
Hi,

A quick question to start - have you mapped the table component from the AUT? My experience shows that tables are notoriously difficult to "grab" in the object mapping mode. If you've got a different component or you've not got the table you think you've got, that could explain it.

Quote:
I have seen more than 7000 thousand visits to the post but not a single answer.

For quick and individual answers, there are support packages available.

Best regards,
Alex
Re: Tables HTML Toolkit [message #1061145 is a reply to message #1061124] Thu, 30 May 2013 04:30 Go to previous message
Joaquin Morcate is currently offline Joaquin Morcate
Messages: 49
Registered: March 2010
Member
Thank you very much for your answer Alex.

Yes, the table is properly mapped. Actually I have notice also some problems about that. In the OM Editor the technical name displayed is the "default name" build using the the contents of the table, although in the properties view the specified name "Contactos"(<table ... testid="Contactos" ...>) is displayed. But with the input for the phone number (<input ....testid="phone3" ... >) in both places the provided technical name (phone3) is displayed.

Nevertheless, I can run some tests that work fine using the table like checking that the table exists.

Thank you very much for your support offer, but I'm working with Jubula just for fun. On the other hand I want to find out how many people is actually interested in Jubula. If the community is not backing the project it won't last much longer. And honestly I can see you answering questions but very few people sharing their findings.

Well, I may be totally mistaken.

Thank you very much again
Previous Topic:Problem by using Jubula via update site mechanism
Next Topic:Jubula 2.0
Goto Forum:
  


Current Time: Fri Apr 18 14:17:22 EDT 2014

Powered by FUDForum. Page generated in 0.01812 seconds