The web element is a table. I manage to get the data inside of it but clicking it is not working. Tried changing the class but it doesn't work. I already got the XPATH it's just that I'm not familiar how to execute the click method.
Dim clickMethod As IHTMLElementCollection = HTMLDoc.getElementsByTagName("td")
For Each element As IHTMLElement In clickMember
If element.getAttribute("title") = " " & lblFirstName.Text & " " Then
element.removeAttribute("class")
element.setAttribute("class", "button button-green default-button")
element.click()
End If
Next
I have a problem with my code, the web element is a table. I manage to get the data inside of it but clicking it is not working. Tried changing the class but it doesn't work. I already got the XPATH it's just that I'm not familiar how to execute the click method.
Dim click As IHTMLElementCollection = HTMLDoc.getElementsByTagName("td")
For Each element As IHTMLElement In clickMember
If element.getAttribute("title") = " " & lblFirstName.Text & " " Then
element.removeAttribute("class")
element.setAttribute("class", "button button-green default-button")
element.click()
End If
Next
I'm trying to click an element on a days-grid of the calendar-slider
I am able to find the element by looping the xpath but can't click it as "ElementNotVisibleError" / "element not interactable"
For i = 1 To 42
If obj.FindElementByXPath("/html/body/div[10]/div/div/div/div/div/div/div/div[2]/ul[2]/li[" & i & "]").Attribute("data-ctx-id") = loadingdate Then
obj.FindElementByXPath("/html/body/div[10]/div/div/div/div/div/div/div/div[2]/ul[2]/li[" & i & "]").Click
GoTo got_it_1
End If
Next i
any hint?
add: link to source: google
maybe the element you're seeking is not visible yet. selenium can't click the element if it isn't visible
Thanks in advance for the help. I have no idea what I'm doing wrong and it's becoming very frustrating. First, a little background...
Program: Revit MEP 2015
IDE: VS 2013 Ultimate
I have created a Shared Parameter file and added the parameters in that file to the Project Parameters. These parameters have been applied to Conduit Runs, Conduit Fittings, and Conduits.
I'm using VB.NET to populate the parameters with no issue. After the code runs, I can see the expected text applied in the elements property window. Here is the code used to populate the values:
Populate:
Dim p as Parameter = Nothing
Dim VarName as String = "Parameter Name"
Dim VarVal as String = "Parameter Value"
p = elem.LookupParameter(VarName) <-- elem is passed in to the function as an Element
If p IsNot Nothing Then
p.Set(VarVal)
End if
Here's where I run into the error. When I attempt to retrieve the value, I am able to get the parameter by the parameter's definition name, but the value is always blank. Here is the code used to retrieve...
Try
For Each e As Element In fec.OfCategory(BuiltInCategory.OST_ConduitRun)
sTemp = sTemp & "Name: " & P.Definition.Name & vbCrLf & "Value: " & P.AsString & vbCrLf & "Value As: " & P.AsValueString & vbCrLf & vbCrLf
sTemp2 = sTemp2 & "Name: " & GetParamInfo(P, doc)
Next
MessageBox.Show(sTemp)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
The message box shows all of the parameter names correctly, and for the Revit parameters it gives me a value. The Shared parameters, however, only show the parameter names, the values are always blank. Is there another way that I'm supposed to be going about this? Oddly, I'm able to see the shared parameter values if I use a reference by user selection like so...
Dim uiDoc As UIDocument = app.ActiveUIDocument
Dim Sel As Selection = uiDoc.Selection
Dim pr As Reference = Nothing
Dim doc As Document = uiDoc.Document
Dim fec As New FilteredElementCollector(doc)
Dim filter As New ElementCategoryFilter(BuiltInCategory.OST_ConduitRun)
Dim sTemp As String = "", sTemp2 As String = ""
Dim elemcol As FilteredElementCollector = fec.OfCategory(BuiltInCategory.OST_ConduitRun)
Dim e As Element = Nothing, el As Element = Nothing
Dim P As Parameter
pr = Sel.PickObject(ObjectType.Element)
e = doc.GetElement(pr)
For Each P in e.Paramters
sTemp = sTemp & "Name: " & P.Definition.Name & vbCrLf & "Value: " & P.AsString & vbCrLf & "Value As: " & P.AsValueString & vbCrLf & vbCrLf
sTemp2 = sTemp2 & "Name: " & GetParamInfo(P, doc)
Next
MessageBox.Show(sTemp)
With the method above, when the user selects the object directly, I can see the values and the names of shared parameters. How are they different?
Is there some sort of binding that I should be looking at when the value is set to begin with? Thanks in advance for everyone's help.
Regards,
Glen
Holy Bejeesus... I figured it out, but I'm not sure why the methods are that different from each other... if anyone had any insight, that'd be great.
I wanted to post the answer here, just in case anyone else is fighting with the same thing, so... you can see the method I was using to try to read the parameters above. In the method being used now there are only a couple of things that are different... 1) An element set... 2) An active view Id was added as a parameter to the FilteredElementCollector... 3) A FilteredElementIterator was implemented.
As far as I can tell it's the iterator that's making it different... can anyone explain what it's doing differently?
Below is the method that actually works...
Public Sub Execute(app As UIApplication) Implements IExternalEventHandler.Execute
Dim prompt As String = ""
Dim uiDoc As UIDocument = app.ActiveUIDocument
Dim doc As Document = uiDoc.Document
Dim ElemSet As ElementSet = app.Application.Create.NewElementSet
Dim fec As New FilteredElementCollector(doc, doc.ActiveView.Id)
Dim fec_filter As New ElementCategoryFilter(BuiltInCategory.OST_Conduit)
fec.WhereElementIsNotElementType()
fec.WherePasses(fec_filter1)
Dim fec_i As FilteredElementIterator = fec.GetElementIterator
Dim e As Element = Nothing
fec_i.Reset()
Using trans As New Transaction(doc, "Reading Conduit")
trans.Start()
While (fec_i.MoveNext)
e = TryCast(fec_i.Current, Element)
ElemSet.Insert(e)
End While
Try
For Each ee As Element In ElemSet
GetElementParameterInformation(doc, ee)
Next
Catch ex As Exception
TaskDialog.Show("ERROR", ex.Message.ToString)
End Try
trans.Commit()
End Using
End Sub
At any rate, thanks for any help that was offered. I'm sure it won't be the last time that I post here.
Regards,
Runnin
I am trying to access Some HTML buttons. I am using vb.net 2008 platform to click these buttons programatically . Problem is that the all 17 buttons are without id and have the same name type and value and are in a same form . So plz guide me how to click each button indivisually . Here is the HTML code of the these buttons.
lets say that the you got a webbrowser control
And The Html Is:
"<button id=namee>Click</button><button id=namee>Click</button><button id=namee>Click</button>"
you can change the id's of the butoons + click them:
WebBrowser1.Navigate("")
Do While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
Loop
WebBrowser1.Document.Body.InnerHtml = "<button id=namee>Click</button><button id=namee>Click</button><button id=namee>Click</button>"
For i = 1 To 3
WebBrowser1.Document.Body.InnerHtml = Replace(WebBrowser1.Document.Body.InnerHtml, "namee", "n" & i.ToString, , 1)
Next
WebBrowser1.Document.GetElementById("n1").InvokeMember("click")
WebBrowser1.Document.GetElementById("n2").InvokeMember("click")
WebBrowser1.Document.GetElementById("n3").InvokeMember("click")
there is another way:
Dim Elems As HtmlElementCollection
Dim WebOC As WebBrowser = WebBrowser1
Elems = WebOC.Document.GetElementsByTagName("button")
For Each elem As HtmlElement In Elems
elem.InvokeMember("click")
Next