RodrigoFinguer
Board Regular
- Joined
- Jun 13, 2017
- Messages
- 75
Hello guys, i really need your help!!
I want to get a value from excel and paste inside a website and click a button to get information about this value from excel.
I managed to copy value from excel and paste on the website, but i can't click on "Find" button, there is inside a form on this website.
This is the wesite code and the highlighted button code:
<form>
For which product are you searching Product data?
<input name="search-input-productdata" id="search-input-productdata" type="text" value="" data-bind="value:SearchTerm.SearchText,valueUpdate:'afterkeydown'">
<button class="button" id="search-button-productdata" aria-disabled="false" *******="return tracker.track4App('DuD_Productdata', 'Product data', 'BTN_FIND','Clicked: [Find]')" type="submit" aria-role="button">
Find
</button>
Here is the code i am using:
Sub Automate_IE_Load_Page()
'This will load a webpage in IE
Dim i As Long
Dim URL As String
Dim IE As InternetExplorer
Dim ieApp As Object
Dim objElement As Object
Dim objCollection As Object
Dim allHREFs As New Collection
Dim btn As HTMLButtonElement
'Create InternetExplorer Object
Set IE = CreateObject("InternetExplorer.Application")
'Set IE.Visible = True to make IE visible, or False for IE to run in the background
IE.Visible = True
'Define URL
URL = "https://www.sew-eurodrive.de/os/dud/?tab=productdata&country=DE&language=en_US"
'Navigate to URL
IE.navigate URL
' Statusbar let's user know website is loading
Application.StatusBar = URL & " is loading. Please wait..."
' Wait while IE loading...
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
'Webpage Loaded
Application.StatusBar = URL & " Loaded"
'Coloca a data de um ano atrás no campo "Data De" e hoje no "Data Até"
IE.document.getElementById("search-input-productdata").Value = Sheets("Planilha2").Range("B2").Text
'IE.document.getElementById("search-button-productdata").Click
'1ST attempt to click
Set btn = IE.document.querySelector("button[class=button]")
btn.Click
'2nd attempt to click
Set tags = IE.document.getElementsByTagName("button")
For Each tagx In tags
If tagx.innerText = " Find " Then
tagx.Click
Exit For
End If
Next
<style>
.hist-table tbody tr td {
padding:0;
vertical-align:top;
}
</style>
</form>
I want to get a value from excel and paste inside a website and click a button to get information about this value from excel.
I managed to copy value from excel and paste on the website, but i can't click on "Find" button, there is inside a form on this website.
This is the wesite code and the highlighted button code:
<form>
For which product are you searching Product data?
<input name="search-input-productdata" id="search-input-productdata" type="text" value="" data-bind="value:SearchTerm.SearchText,valueUpdate:'afterkeydown'">
<button class="button" id="search-button-productdata" aria-disabled="false" *******="return tracker.track4App('DuD_Productdata', 'Product data', 'BTN_FIND','Clicked: [Find]')" type="submit" aria-role="button">
Find
</button>
Here is the code i am using:
Sub Automate_IE_Load_Page()
'This will load a webpage in IE
Dim i As Long
Dim URL As String
Dim IE As InternetExplorer
Dim ieApp As Object
Dim objElement As Object
Dim objCollection As Object
Dim allHREFs As New Collection
Dim btn As HTMLButtonElement
'Create InternetExplorer Object
Set IE = CreateObject("InternetExplorer.Application")
'Set IE.Visible = True to make IE visible, or False for IE to run in the background
IE.Visible = True
'Define URL
URL = "https://www.sew-eurodrive.de/os/dud/?tab=productdata&country=DE&language=en_US"
'Navigate to URL
IE.navigate URL
' Statusbar let's user know website is loading
Application.StatusBar = URL & " is loading. Please wait..."
' Wait while IE loading...
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
'Webpage Loaded
Application.StatusBar = URL & " Loaded"
'Coloca a data de um ano atrás no campo "Data De" e hoje no "Data Até"
IE.document.getElementById("search-input-productdata").Value = Sheets("Planilha2").Range("B2").Text
'IE.document.getElementById("search-button-productdata").Click
'1ST attempt to click
Set btn = IE.document.querySelector("button[class=button]")
btn.Click
'2nd attempt to click
Set tags = IE.document.getElementsByTagName("button")
For Each tagx In tags
If tagx.innerText = " Find " Then
tagx.Click
Exit For
End If
Next
<style>
.hist-table tbody tr td {
padding:0;
vertical-align:top;
}
</style>
</form>