1. Michael Krul
  2. PowerBuilder
  3. Tuesday, 2 July 2024 08:19 AM UTC

Hello,

We go from MicrosoftWebBrowser (PB17) to WebBrowser (PB22).
What will this code look like with new objects?

1. ls_value = ole_1.Object.Document.getElementByID('mmm').value

2. ole_ilink = ole_1.Object.Document.ActiveElement

3. ole_1.Object.Document.ScrollTop = 555

4. ole_1.Object.Document.getElementByID('my_form').submit()

5. lole_1.Object.Document.ParentWindow.ExecScript('my_fun();', 'JavaScript')

6. ls_value = ole_1.Object.Document.InnerHTML

Thanks

 

René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 2 July 2024 10:11 AM UTC
  2. PowerBuilder
  3. # 1

I think for most of this you can use EvaluateJavaScriptSync.

You have to write a litte bit JavaScript and execute it. You will get the result in json format.

See the examples.

HTH,

René

Comment
There are no comments made yet.
Michael Krul Accepted Answer Pending Moderation
  1. Wednesday, 3 July 2024 13:38 PM UTC
  2. PowerBuilder
  3. # 2

I need to get the value from the "search" field.
How to do it?

// This code returns NULL

String ls_JS, ls_Result, ls_Error, ls_value
integer li_Return 

ls_JS = 'document.GetElementByID("search").value;'
li_Return = wb_1.EvaluateJavascriptSync(ls_JS, ls_Result, ls_Error)


// RESULT:
li_Return = 1
ls_Result = {"type":"null","value":null}
ls_Error = ''

 

//This code with old MicrosoftWebBrowser:

ls_Result = ole_1.Object.Document.getElementByID('search').value

// RESULT:
ls_Result = Text_from_element

Comment
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Wednesday, 3 July 2024 16:13 PM UTC
  2. PowerBuilder
  3. # 3

Hi Michael,

Assuming the id "search" actually exists and the spelling is the same in the html and the method call (since that's how it looks in your old code), try using a lower case "g" and "d" for the method name in getElementById().

HTH...regards,

Mark

Comment
  1. Michael Krul
  2. Thursday, 4 July 2024 07:18 AM UTC
Thank you!

--- lower case "g" and "d"
  1. Helpful
  1. Mark Goldsmith
  2. Thursday, 4 July 2024 13:32 PM UTC
Glad to hear that worked for you Michael and thanks for the update.
  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.