Skip to content

Instantly share code, notes, and snippets.

@XtinaSchelin
Created April 10, 2017 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XtinaSchelin/2340ad1ac2cd75740b85a9abbeb00f78 to your computer and use it in GitHub Desktop.
Save XtinaSchelin/2340ad1ac2cd75740b85a9abbeb00f78 to your computer and use it in GitHub Desktop.
Selenium IDE script to overwrite, then delete, your LJ entries.
<?xml version="1.0" encoding="UTF-8"?>
<!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.livejournal.com/" />
<title>livejournal_kill</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">livejournal_kill</td></tr>
</thead><tbody>
<!--Store user variables.-->
<tr>
<td>store</td>
<td>the-xtina</td>
<td>username</td>
</tr>
<tr>
<td>store</td>
<td>f9z26q7s</td>
<td>password</td>
</tr>
<tr>
<td>store</td>
<td>хах нет</td>
<td>customText</td>
</tr>
<!--Log into LJ, if needed.-->
<tr>
<td>open</td>
<td>https://www.livejournal.com/login.bml</td>
<td></td>
</tr>
<tr>
<td>storeTextPresent</td>
<td>You are logged in</td>
<td>alreadyIn</td>
</tr>
<tr>
<td>gotoIf</td>
<td>storedVars['alreadyIn'] == true</td>
<td>skipOn</td>
</tr>
<tr>
<td>type</td>
<td>xpath=(//input[@id='user'])[2]</td>
<td>${username}</td>
</tr>
<tr>
<td>type</td>
<td>xpath=(//input[@id='lj_loginwidget_password'])[2]</td>
<td>${password}</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>xpath=(//button[@name='action:login'])[2]</td>
<td></td>
</tr>
<tr>
<td>label</td>
<td>skipOn</td>
<td></td>
</tr>
<!--Go to your main page of entries.-->
<tr>
<td>open</td>
<td>http://the-xtina.livejournal.com/</td>
<td></td>
</tr>
<!--Keep going until there are no more entries.-->
<tr>
<td>storeXpathCount</td>
<td>//li[contains(@class,'item-edit_entry')]/a[contains(@href,&quot;editjournal.bml&quot;)]</td>
<td>entries</td>
</tr>
<tr>
<td>while</td>
<td>parseInt(storedVars['entries']) &gt; 0</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//li[contains(@class,'item-edit_entry')]/a[contains(@href,&quot;editjournal.bml&quot;)][1]</td>
<td></td>
</tr>
<tr>
<td>chooseOkOnNextConfirmation</td>
<td></td>
<td></td>
</tr>
<!--Overwrite the post here.-->
<tr>
<td>type</td>
<td>id=body</td>
<td>${customText}</td>
</tr>
<!--Change the access to private.-->
<tr>
<td>waitForVisible</td>
<td>name=privacy</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>2000</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>name=privacy</td>
<td>label=Private</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=action:update</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//a[contains(@href,&quot;editjournal.bml&quot;)][1]</td>
<td></td>
</tr>
<!--And now, delete the post.-->
<tr>
<td>chooseOkOnNextConfirmation</td>
<td></td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=action:delete</td>
<td></td>
</tr>
<tr>
<td>assertConfirmation</td>
<td>Are you sure you want to delete this entry?</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment