Selenium: delete contents from a textbox

Through selenium. how to delete contents from textbox.

I have to delete the last 2 characters from text box using selenium command.

Ex.ABCD to AB.

Answers


Try this -

selenium.type("text_box_object", "ABCD");
selenium.typeKeys("text_box_object", "\b");
selenium.typeKeys("text_box_object", "\b");

Read the current value and store it as a variable. Then 'Type' out the value that you want in the target field (using a substring of the stored value).


For firefox, the backspace event works only if you setCursorPosition at the END of the text in the textarea, otherwise the typeKeys event will type at the begining of the text.


Click onto it, hit end key and backspace twice


The keyPress event of selenium can be helpful:

selenium.sendKeys("text1", "ABCD");
selenium.sendKeys("text1", "\b");
selenium.sendKeys("text1", "\b");

This will Click Backspace key twice.


Need Your Help

Base64 String to Image

php rest base64

I hava a rest-webservice and i want to upload the image as a base64 string and decode it on my webserver using php.

Is there any possible way that I can manipulate foreign keys in my cakephp model associations?

sql cakephp table model

I am doing a one-to-many relationship in my codes right now. Below is my db:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.