vamyip
vamyip

Reputation: 1171

selenium c# nunit problem getting focus off a textbox

I am testing a web app where a file is to be renamed as follows 1)first click on the files name 2) this will make a textbox appear 3) I type the new name in textbox 4) I have to click outside the textbox so that the new name gets set. or 4) Press enter key

The problem is in step 4. I've tried to get it to click at several places in my app, but the textbox doesn't loose focus and hence the name doesn't get set. I've even tried to use focus command, but, in vain.

Also tried to do this with enter key, but, seems that it doesn't work too. I tried keypress, keypressnative, etc. nothing seems to work.

Note: this sequence works when I do it manually and doesn't work when I do it from IDE or RC for C#.

Any help in this direction??

Thanks, Vamyip

Upvotes: 1

Views: 1452

Answers (2)

Tanin
Tanin

Reputation: 1933

Capybara throws an error because the driver does not support 'blur' So I use:

find('html').click

Upvotes: 0

Moritz Both
Moritz Both

Reputation: 1628

Selenium does not always fire the proper events. Probably your application relys on the blur event of the text box?

Try

selenium.fireEvent(locator_for_textbox, "blur");

Upvotes: 2

Related Questions