0

I'm trying to get InnerText property of HTMLElement of already opened WebBrowser (from SAP GUI Scripting GuiHTMLViewer object > BrowserHandle > Document) using pywin (win32com) lib on Python.

I got a WebBrowser, which have Document property (object HTMLDocument), which have methods, for example:

getElementsByTagName(string TagName)

https://cdn3.imggmi.com/uploads/2019/3/25/04b5bce44c15b2f06369d010b71d9a70-full.png

When I try to use this method on Python

document = browser_handle.document
elements = document.getElementsByTagName("td")

it says

TypeError: getElementsByTagName() takes 1 positional argument but 2 were given

but when I try to use this method on VBA, it's success:

Set BrowserHandle = session.findById("wnd[0]/usr/tabsSO33_TAB1/tabpTAB1/ssubSUB1:SAPLSO33:1100/cntlCONTROL/shellcont/shell").BrowserHandle
Set Document = BrowserHandle.Document
Set Elements = Document.getElementsByTagName("td")
MsgBox Elements.Item(0).InnerText
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48

0 Answers0