Hi,
I come across a very challenging task that I can't find a way to accomplish.
The goal is to to fill/ choose value from a drop down list which I suspect has a Java script applied on it which not allowing me to easy choose value by id.
I manage to type in the value in the search bar, mimc mouse click on the dropdown list icon - see that the entered value is valid and exist in the list but I am not able to find a way how to choose the entered value!
As a human it action it would only be possible to choose the value by one of 2 ways: save = changes saved.
1) type in the value in the search bar, click on the icon to open the dropdown menu - if value is correct I will see the option and will be able to click on it ( the only way to choose is, and make the system save the changes)
2) Click on the drop down Icon > see few global options > open any of them (children) untill I find the desired value > left click on it > save = changes saved.
*Note: If I type the value and press enter it still wont be selected in the system. Only if I click on the value from the drop down menu only then the system will apply the changes after saving.
Hope to find a hint from some one.
Thanks alot for your attention,
Nice42
I come across a very challenging task that I can't find a way to accomplish.
The goal is to to fill/ choose value from a drop down list which I suspect has a Java script applied on it which not allowing me to easy choose value by id.
I manage to type in the value in the search bar, mimc mouse click on the dropdown list icon - see that the entered value is valid and exist in the list but I am not able to find a way how to choose the entered value!
As a human it action it would only be possible to choose the value by one of 2 ways: save = changes saved.
1) type in the value in the search bar, click on the icon to open the dropdown menu - if value is correct I will see the option and will be able to click on it ( the only way to choose is, and make the system save the changes)
2) Click on the drop down Icon > see few global options > open any of them (children) untill I find the desired value > left click on it > save = changes saved.
*Note: If I type the value and press enter it still wont be selected in the system. Only if I click on the value from the drop down menu only then the system will apply the changes after saving.
Code:
Sub User_Setup()
'Application.ScreenUpdating = False
'Application.DisplayAlerts = False
'----------------------------------here I define elemnts for the loop
Dim sht As Worksheet
Set sht = ThisWorkbook.Sheets("Fields")
Dim LastRow As Long
Dim i As Long
LastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row
Dim values() As String
Dim b As Long
Dim frm As Object
Dim dt As Object
'---------------------------------------------here I define Internet Explorer
Dim IE As Object
Dim Doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
'--------------------------------------------- here I define range for the loop
For i = 2 To LastRow
' ---------------------------------------------here I ask the Internet explorer to be visable & Navigate to value in cell "H"i
IE.Visible = True
IE.navigate sht.Range("A" & i).Value
' ---------------------------------------------here I ask the Internet explorer to wait few seconds
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set Doc = IE.document
'--------------------------------- Here is my issue with the dropdown
Doc.getElementById("tab7").Click ' clicks the tab where the dropdown exists
Doc.getElementById("ResourceWorkgroup").Value = sht.Range("X" & i).Value ' This is the value needs be choosen in the dropdown
Doc.getElementById("ResourceWorkgroup").FireEvent "onfocus" ' this event should make the value just inserted be highlited
'----
Doc.getElementById("_IB_imgResourceWorkgroup").Click ' this is the action that mimic mouse click on the "open drop down" icon
Doc.getElementById("_IB_imgResourceWorkgroup").FireEvent "onfocus" 'not sure if this line is even helpful
'----
[COLOR=#008000]'NOTE:I manage to enter the value in the search field, and the click the dropdown list icon,
'(mimic the mouse click on the open dropdown list icon) [/COLOR][COLOR=#ff0000]without really choosing the value.
[/COLOR]
Application.Wait Now + TimeValue("00:00:10")
Doc.getElementById("Master_IdBtnSave").Click ' click on save button
Doc.getElementById("Master_IdBtnSave").FireEvent "*******" 'trigger the event of saving (not sure if this neccery aswell)
Next i
End Sub
Hope to find a hint from some one.
Thanks alot for your attention,
Nice42