Hi Team, Im trying to click on the below button but i couldn't, below is the html code i have.
I tried with xpath like
driver.FindElementByXPath("//a[contains(text(),'https']").Click
driver.FindElementByXPath("//a[@href,'#']").Click ' this work, but this clicks on sign out drop down button
driver.FindElementByXPath("//a[@class,'btn btn-default']").Click
Could some one help me in this. Thanks
<a href="#" class="btn btn-default" data-bind="click : downloadFiles, visible: $root.attachmentsViewModel.files().length > 0">
<i class="fa fa-download js-app-action-el" aria-hidden="true"></i>
Download <strong data-bind="text:$root.attachmentsViewModel.files().length">5</strong> Files
</a>
Hi,
It'll be easier to do if you can supply the url of the page rather than just having a fragment of the age to work with.
regards
Phil
Hi Philip, thanks for the immediate reply.. I don't have rights to send the URL details.. that is the reason I have not included URL in the post. When I checked, I for the above html code for that particular button... Is it possible to guide with that code .. Thanks
Hi Rajsha,
If it's not publicly accessible or requires a login, can you at least view the page source code and copy/paste that into a text file.
There are some techniques of locating elements that require the entire page to be known, for example, locating the nth <a> tag. Without knowing how many <a> tags, or buttons, are on the page, I can't properly use that approach.
Phil
Hi Philip,
I found the solution for the button, below is the code that i have found to click on the button.
.FindElementByXPath("//a[@class='btn btn-default'][1]").Click
Since in the 4th post you stated (locating the nth <a> tag.) this gave me the clue to find the above code. There are 5 buttons total i the web page and the button i need is located the 2nd place of a> tag.
Thank you Philip for the idea.
Thanks
Rajsha
No worries. That's why I needed the whole page so I could count things like that 🙂