Dave_O
New Member
- Joined
- Dec 3, 2019
- Messages
- 8
- Office Version
- 2016
- Platform
- Windows
Hello,
I am using VBA Selenium to find each URL, by clicking on the next XPath.
VBA gives me a run-time error code 7
"NoSuchElementError"
Here is a sample of XPaths that I need to click:
#1 XPath
/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[1]
#2 XPath
/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[2]
#3 XPath
/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[3]
Required Outcome:
worksheet "Import" has a listing of each URL for each XPath in column D
[Sub Import()
Set WD = New ChromeDriver
URL = "https://www.bet365.com.au/#/AC/B2/C103/D20211028/E20777045/F109877762/H543/P12/"
With WD
.Start "Chrome"
.Get URL, timeout:=40000
'Can't Click No.
.FindElementByXPath("/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[1]").Click
MyString = WD.URL
Sheets("Import").Range("D" & lRow + 1) = MyString
'Next Click
'Can't Click No.
.FindElementByXPath("/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[2]").Click
MyString = WD.URL
Sheets("Import").Range("D" & lRow + 1) = MyString
'Next Click
'Can't Click No.
.FindElementByXPath("/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[3]").Click
MyString = WD.URL
Sheets("Import").Range("D" & lRow + 1) = MyString
End Sub]
I am using VBA Selenium to find each URL, by clicking on the next XPath.
VBA gives me a run-time error code 7
"NoSuchElementError"
Here is a sample of XPaths that I need to click:
#1 XPath
/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[1]
#2 XPath
/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[2]
#3 XPath
/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[3]
Required Outcome:
worksheet "Import" has a listing of each URL for each XPath in column D
[Sub Import()
Set WD = New ChromeDriver
URL = "https://www.bet365.com.au/#/AC/B2/C103/D20211028/E20777045/F109877762/H543/P12/"
With WD
.Start "Chrome"
.Get URL, timeout:=40000
'Can't Click No.
.FindElementByXPath("/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[1]").Click
MyString = WD.URL
Sheets("Import").Range("D" & lRow + 1) = MyString
'Next Click
'Can't Click No.
.FindElementByXPath("/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[2]").Click
MyString = WD.URL
Sheets("Import").Range("D" & lRow + 1) = MyString
'Next Click
'Can't Click No.
.FindElementByXPath("/html/body/div[1]/div/div[3]/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div[3]").Click
MyString = WD.URL
Sheets("Import").Range("D" & lRow + 1) = MyString
End Sub]