-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Method. GetAttribute, GetInnerHTML, GetOuterHTML #34
Comments
On the WebDriver functions GetInnerHTML and GetOuterHTML, suggest the following changes to default to document body if ElementId not specified:
|
@ezagdd , if you don't mind me asking, why does GetAttribute handle the cases where user inputs "innerHTML" or "outerHTML"? I'm not an HTML nor JavaScript expert so was wondering... Thx! |
Below is a proposal for adding HasAttribute function, and modifying GetAttribute... Any comments?
|
GetAttributeで「innerHTML」や「outerHTML」を処理しているのは当時のテストの名残かもしれません。ハッキリ言って覚えていないです。 The fact that GetAttribute handles "innerHTML" and "outerHTML" may be a remnant of testing back then. I can't remember for sure. Public Function GetAttribute(ByVal value As String, _
ByVal ElementId As String, _
Optional ByVal sessionId As String = vbNullString) As String
Dim Script As String
Script = "return arguments[0].getAttribute('" & value & "')"
If HasAttribute(value, ElementId, sessionId) Then
'below will return a VBA Null if attribute does not exist
GetAttribute = ExecuteScript(Script, vbNullString, ElementId, sessionId)
Else
GetAttribute = ""
End If
End Function Public Function HasAttribute(ByVal value As String, _
ByVal ElementId As String, _
Optional ByVal sessionId As String = vbNullString) As Boolean
Dim Script As String
Script = "return arguments[0].hasAttribute('" & value & "')"
HasAttribute = ExecuteScript(Script, vbNullString, ElementId, sessionId)
End Function |
Yeah, I changed my version of the entire code base (@uezo's & your contributions) to take on webelement parameters as opposed to webelement.elementid at the user level. See this discussion... Sorry about the confusion... |
Add Method. GetAttribute, GetInnerHTML, GetOuterHTML #34
GetAttribute:要素の属性名から属性値を取得する。
GetInnerHTML:要素のinnerHTMLを取得する。
GetOuterHTML:要素のouterHTMLを取得する。
TinySeleniumVBA WebDriver.cls
TinySeleniumVBA WebElement.cls
The text was updated successfully, but these errors were encountered: