Sending "Enter" key via QTP

Hi,

I have an application with 25 fields(textboxes).On entering data in 5th field and pressing an enter key will automatically populate data in 6th field.

How do i achieve this with QTP.

I used the below code and nothing happened.

CODE:

Browser("Browser").Page("Page").Frame("body").WebEdit("type:=text","name:=InsuranceCode","html tag:=INPUT").Set insurance_code

Set WshShell = CreateObject("WScript.Shell")
Browser("Browser").Page("Page").Frame("body").WebEdit("type:=text","name:=InsuranceCode","html tag:=INPUT").Click
WshShell.SendKeys("ENTER")
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "ENTER"
Set WshShell = Nothing
Wait 2


I tried with submit function and it submitted the whole screen, which is not the desired action.

Could you please help me on this?
thanks
Swami
Parents
  • Try clicking on the webedit box first then use the sendkeys

    Browser("Browser").Page("Page").Frame("body").WebEdit("type:=text","name:=InsuranceCode","html tag:=INPUT")).Set insurance_code

    Browser("Browser").Page("Page").Frame("body").WebEdit("type:=text","name:=InsuranceCode","html tag:=INPUT")).click

    Set WshShell = CreateObject("WScript.Shell")
    Browser("Browser").Page("Page").Frame("body").WebEdit("type:=text","name:=InsuranceCode","html tag:=INPUT").Click
    WshShell.SendKeys("ENTER")
    WshShell.SendKeys "{ENTER}"
    WshShell.SendKeys "ENTER"
    Set WshShell = Nothing
    Wait 2
Reply
  • Try clicking on the webedit box first then use the sendkeys

    Browser("Browser").Page("Page").Frame("body").WebEdit("type:=text","name:=InsuranceCode","html tag:=INPUT")).Set insurance_code

    Browser("Browser").Page("Page").Frame("body").WebEdit("type:=text","name:=InsuranceCode","html tag:=INPUT")).click

    Set WshShell = CreateObject("WScript.Shell")
    Browser("Browser").Page("Page").Frame("body").WebEdit("type:=text","name:=InsuranceCode","html tag:=INPUT").Click
    WshShell.SendKeys("ENTER")
    WshShell.SendKeys "{ENTER}"
    WshShell.SendKeys "ENTER"
    Set WshShell = Nothing
    Wait 2
Children