• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Vba click on the button to download files|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Vba click on the button to download files|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosVba click on the button to download…
sp_PrintTopic sp_TopicIcon
Vba click on the button to download files
Avatar
Gold Berg

New Member
Members
Level 0
Forum Posts: 2
Member Since:
August 6, 2020
sp_UserOfflineSmall Offline
1
August 6, 2020 - 10:04 pm
sp_Permalink sp_Print

Hi All,
I'm happy to have such a form to clear Excel/vba based queries. This is the site that i got to know from my friend.

My query is, I'm new with Selenium automation. Although I'm able so far to open edge and access the required Web page.
but I'm unable to download the file.

I tried to click on the button using XPath but not able to do so for.

Code of the button where I need to click on "download" is placed below. Also i have listed vba code that i had tried.

<a href="#" class="btn btn-default" data-bind="click : downloadfiles, visible: $root.filesViewModel.files().length > 0">
<i class="fa fa-download js-app-action-li" aria-hidden="true"></i>
Download <strong data-bind="text:$root.filesViewModel.files().length">5</strong> Files
</a>

Sub DownloadFile()
Dim DR As WebDriver

Set DR = New EdgeDriver
Const URL = "url"
With DR
.Start "Edge"
.Get URL
.FindElementByXPath("//a[@class='btn btn-default'][1]").Click
Application.Wait Now + TimeSerial(0, 1, 0)
.Quit
End With
End Sub

When i tried with the above code i got the below error message, im not sure why i see this message.

Run-time error '13':
UnknownError
Element is obscured

Please let me know if you team need any thing that i have to do.

Thanks

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1514
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
August 6, 2020 - 10:40 pm
sp_Permalink sp_Print

Hi,

I don't see how that code will work, URL isn't set to an actual URL?

Without the full VBA and HTML code from the web page it makes it difficult to give you an answer.

Can you please attach your workbook with code and either the URL to the web page, or the source code of the web page you are trying to get data from.

Thanks

Phil

Avatar
Gold Berg

New Member
Members
Level 0
Forum Posts: 2
Member Since:
August 6, 2020
sp_UserOfflineSmall Offline
3
August 6, 2020 - 11:21 pm
sp_Permalink sp_Print

Hi Philip,

Since those url details are related to my work environment, i'm not supposed to expose those details which you asked. Possible can you suggest me the error msg i got and how to overcome that "Error: Element is Obscured".

Thanks

Gold

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1514
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
4
August 7, 2020 - 11:55 am
sp_Permalink sp_Print

Hi Gold,

Not being able to see the entire web page makes it difficult to give you code that will work, so I can only go with what you have provided.

If I copy/paste the HTML you've provided into a file D:/temp/gold.htm, the following code works for me using Chrome.  Should work for you too with Edge.

 

   Sub ClickButton()

      Dim driver As New Selenium.ChromeDriver

      With driver

         .Get "file:///D:/temp/gold.htm"

         Application.Wait (Now + TimeValue("00:00:05"))

         .FindElementByXPath("//a[@class='btn btn-default'][1]").Click

      End With

      Set driver = Nothing

   End Sub

 

Regards

Phil

Avatar
Anders Sehlstedt
Eskilstuna, Sweden

VIP
Members


Trusted Members
Level 3
Forum Posts: 870
Member Since:
December 7, 2016
sp_UserOfflineSmall Offline
5
August 7, 2020 - 4:31 pm
sp_Permalink sp_Print

Hello,

I don't know if this issue is related, but fun things do happen in Edge if browser zoom is other than 100%.

Br,
Anders

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: MohamedGadAllah, RAMEZ ATTAR, Kylara Papenfuss, Janset Beyaz, Shawn Barwick, Nada Perovic
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
John Chisholm
vexokeb sdfg
John Jack
Malcolm Toy
Ray-Yu Yang
George Shihadeh
Naomi Rumble
Uwe von Gostomski
Jonathan Jones
drsven
Forum Stats:
Groups: 3
Forums: 24
Topics: 6212
Posts: 27236

 

Member Stats:
Guest Posters: 49
Members: 31889
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.