Click a Button with data-toggle and data-target using VBA - html

I am trying to web scrape with the following HTML by clicking on a button:
I have tried appIE.document.getElementById("btnAddFruit").click
<button type="button"
data-toggle="modal" data-target="#secondary-dialog"
id="btnAddFruit"
class="edt btn btn-red pull-right margin-left-10">
<span class="glyphicon glyphicon-plus-sign">
</span> Fruits</button>
The IE also does not show the pop up window.
Any help is much appreciated.
Edit: I made a typo on the ID and have corrected it

I am confused as the id shown is btnAddFruit
ie.document.querySelector("#btnAddFruit").click
Which is equivalent to
ie.document.getElementById("btnAddFruit").click
Otherwise, please detail what the error message is and on which line (show more of your code as well would help)

Related

I have a problem with <button>. I don't know what I'm doing wrong

I'm just a beginner and I'm trying to add a button with url to website.
It works in browser, but for some reason Dreamweaver keeps giving me error that special characters need to be escaped. Please help, what am I doing wrong?
Here's the button code I've written (of course button class has definition in style)
<button class="button button2", onclick="location.href=url.html">url_text</button>
Try this instead:
<button class="button button2" onclick="location.href='url.html'">url_text</button>

Bootstrap Button - No Hand Cursor

I am developing an MVC6 project in Visual Studio 2015. I have just added Bootstrap 3.3.6 using Bower. On a very simple html page I have referenced the CSS in the header and Bootstrap at the bottom of the body as follows:
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<script type="text/javascript" src="~/lib/bootstrap/dist/js/bootstrap.min.js"></script>
I defined a button as follows:
<button class="btn btn-primary">Hello</button>
When I debug the project (IIS, IE11) the button appears and is clearly styled by Bootstrap but there is no hand cursor.
If I use the browser to navigate to an example of a Bootstrap styled button, for example here: http://www.w3schools.com/bootstrap/bootstrap_buttons.asp, the hand cursor appears as I would expect. So it's not my browser at fault.
Can anyone suggest why I am not getting a hand cursor from a simple Bootstrap styled button please?
Try add role='button' instead. I have had this problem even though the documentation on bootstrap says type='button' should do the work but mine didn't.
You need to get rid of the button tags and just use anchor tags with bootstrap classes. For example:
instead of:
<button class="btn btn-primary">Hello </button>
write:
Hello
This will make the HAND CURSOR appear when hovering over the btn bootstrap class
Try adding an href such as href="#" to the button.
<button class="btn btn-primary" href="#">Hello</button>
When you start changing native element types and roles there are other side effects, including how those elements interact with accessibility for users. See this MDN link for details on that: Button Role
You are missing the type="button".
In bootstrap source less file there are several css rules specified for the input[type="button"] rule. (Checked for version 3.3.6)
You might not have to use it, but it was intended to be used with type="button".
In both W3School and Bootstrap buttons demo page they are using type="button"
Your code:
<button class="btn btn-primary">Hello</button>
W3:
<button type="button" class="btn btn-default">Default</button>
If it is still not working after adding type="button" (or submit or reset), try looking on your element with inspector and see what overrides the "pointer: cursor" css rule.
I was looking like you for a way to add this hand over,
until I saw that hand appearing once the form was filled.
(was using
<button type="button" >
by the way )
Create new css:
.cursor-pointer { cursor: pointer; }
Apply css on button:
class="cursor-pointer"
I encountered the same issue. When hover over the button hand cursor is not shown instead mouse pointer is seen. Fixed it by using the following ways.
1st Fix:
<input type="button" id="myBtn" class="btn btn-primary" value="Hello">
2nd Fix:
<a role="button" class="btn btn-primary" href="#">Hello</a>

Button link redirect issue

I have this button on my website which I am using to redirect to another page when clicked using the onclick function. The problem is, when it is clicked, it just shows the 404 page? Any ideas why this is happening?
<button class="btn btn-sm btn-badge" type="button" onclick="location.href = 'user_page.php&show=1?badge=Available';"><i class="fa fa-sort" style="color:#963"></i> Available </button>
It seems like you have your link incorrect - it should be ? first and then &.
Like this:
user_page.php?show=1&badge=Available
That should then solve your problem.
Try this :
onclick="javascript:location.href='user_page.php&show=1?badge=Available'"

Button Click not working in Selenium IDE

All,
I am using clickAndWait xpath=//button[contains(.,'Next')], it does show when i click find on Selenium IDE but doesn't click on the Button. The button has id = pmc_wizard_next and class = btn btn-next.
The html for the button is:
<div id="pmc_wizard" class="wizard pmc-wizard">
<ul class="steps pmc-wizard-steps"> … </ul>
<div class="actions pmc-wizard-actions">
<button id="pmc_wizard_prev" class="btn btn-prev"> … </button>
<button id="pmc_wizard_next" class="btn btn-next" data-last="Submit">
Next
<i class="icon-arrow-right"></i>
</button>
</div>
</div>
In my case, when the button is clicked it doesn't navigate it to the next page however it does perform all the actions on the next page.
Thanks.
clickAndWait generally gives the timeout error . you can either use
click|target|
waitForElementPresent|the next element that could be possibly reached after click|
hope this answer would help you!

How to integrate Disqus comment counter into Bootstrap button?

I am trying to make Disqus comment counter link in Bootstrap button, but everything I tried was unsuccessful.
The idea is that the whole button should be link.
When I am trying to do like this:
<a href="page.html#disqus_thread">
<button type="button" class="btn btn-default"></button>
</a>
the Disqus just overwriting everything about Bootstrap button CSS and just leave naked link like "1" (I left just number in disqus settings).
When I am trying this way:
<button type="button" class="btn btn-default">
</button>
the button appears, as well as comment counter link, but the button is not the link like if it was wrapped into <a> tag. So I need some help.
What you are trying is not valid HTML. Try something like this: