Getting Cursor Position From WebEdit - Codoid
Select Page
Codoid Blog

Getting Cursor Position From WebEdit

Being a leading QA Company, we write blogs on all prominent software testing topics and tools using our real-world experience. So stay sharp by subscribing to our Newsletter.

If you want to retrieve cursor position from an WebEdit, it can be done using Range boundary from Selection.

Code

Dim oPage:Set oPage=Browser("name:=Google").Page("title:=Google")
Dim oSel:Set oSel=oPage.Object.Selection.createRange
Dim oWebEdit:Set 

oWebEdit=oPage.WebEdit("name:=q").Object

oSel.moveStart "character",-Len(oWebEdit.value)

Msgbox  Len(oSel.text)
'Here you will get the cursor position.

Set oPage=Nothing
Set oSel=Nothing
Set oWebEdit=Nothing
  

Submit a Comment

Your email address will not be published.


If you want to retrieve cursor position from an WebEdit, it can be done using Range boundary from Selection.

Code

Dim oPage:Set oPage=Browser("name:=Google").Page("title:=Google")
Dim oSel:Set oSel=oPage.Object.Selection.createRange
Dim oWebEdit:Set 

oWebEdit=oPage.WebEdit("name:=q").Object

oSel.moveStart "character",-Len(oWebEdit.value)

Msgbox  Len(oSel.text)
'Here you will get the cursor position.

Set oPage=Nothing
Set oSel=Nothing
Set oWebEdit=Nothing