Please excuse me for asking such a specific question, but I am trying to help a parent automate the filling out of information on the a website which they must do daily for their child to go to school.
Here is the relevant HTML snippet from the above website
<div class="text-center" id="btnDailyScreeningSubmit">
<button type="button" class="btn btn-primary mt-2 btn-lg" onclick="showLayout('#guest_questions')">Fill Out Daily Screening</button>
</div>
I am trying to click on the button at the bottom of the page that says "Fill Out Daily Screening" using JS. The JS will be integrated into a Siri Shortcut, using the Scriptable App for iPhone, so I am able to import some JS libraries into the script if that would help this at all.
I have tried
document.getElementById("btnDailyScreeningSubmit").click();
document.getElementById("btnDailyScreeningSubmit").submit();
which does not work. Nothing happens on the webpage and the Chrome JS Console comes back with "undefined".
I have tried the generic
document.forms[0].submit();
Which I guess submits the form, but that is not what the site is looking for. Instead of going on to the next page, the browser returns a JSON response.
I was hoping there might be a way to click the button based on its location on the website, but I have not been able to find anything promising in that area.
So I am reaching out to all the JS experts on here to find out if there is a way to click that button on that website?
You need to click the button inside the div element instead.
document.getElementById("btnDailyScreeningSubmit").querySelector('button').click();
You cannot click things from javascript until the user has clicked on the page... add a mousedown listener to the window then try it.
Related
I am trying to automate a task with python. This task is simply to open a link, put some text into the field and click the button. I can't seem to figure out where the link is for this button/how to click this button through python or a different programming language. I dont see an onclick() or ref/link for it. When I get the html code for the site the button is not in it but when I inspect the elements of the page I can see it. Please let me know what I should do thanks in advance. webpage_elements
I'm trying to make a web-scraper in Node JS and I've hit a roadblock.
I need to click on a button BUT, if I'm not mistaken, Node doesn't actually render the web-page like a browser would so I can't use a selector or X-Path.
How then, could I click a specific button with the value "yes" if I can't use the selector or X-path? There's no id unique to only the yes button.
I'm asking this because I want to parse a specific web-page but I get redirected to a page that asks me to press two buttons.
Pressing 'Yes' will bring me to the page I want. Pressing 'No' will obviously stop me from going forward.
Is there any way to do what I want within the confines on Node without having to resort to something like JSDOM?
Here's part of the HTML i'm working with:
<div class="buttons">
<button class="c-btn c-btn-primary" type="submit" name="bigbutton" value="no">no thank you</button>
<button class="c-btn c-btn-primary" type="submit" name="bigbutton" value="yes">continue</button>
</div>
I tried using something like this:
document.getElementByID("selector").click()
but was returned with 'ReferenceError: document is not defined'.
Have you tried to use Zombie? I've used and worked well! This link is very helpful, since clarify quickly how to perform actions.
Hi i want a button to be shown on all my pages.
that code should be in such a way that no form filling is needed
the text on button will be "Problem? Click Here"
when click on button, it will be pressed and the person who has clicked cannot click again unless reload the page.
After the button is clicked the mail should be sent to admin with the exact link of page where button was clicked.
there should be no form to fill.
As for example facebook like button like the content meanwhile its pressed.
What should be the code for this? Any suggestion please?
Thank you
You can use an HTML button element with an onclick javascript function linked to it.
Since you don't want the button to work again until you have reloaded the page, you will need to do this through AJAX. This means you will have to send a request to the server, where, for instance, a PHP script will retrieve the page name from a GET variable and send the email to the administrator. The javascript part can keep track of the button being clicked once or not.
That should give you some pointers on where to start with your code. However, as stated in direct comments to your question, this site is not meant for asking for coding work to be done for you. Perhaps next time, try to think of a possible solution and ask for advice on your solution (improvements, coding conventions, etc)
When clicking in one of 3 different buttons (different onclicks, different ids) the page refreshes itself, it started today, but all day i added a lot of new functions so its becoming very difficult to find the cause. Different browsers/computers have this issue.
I´m using XAMPP so i dont have a live version and the site is too big to post the functions.
How can i debug this? Does Firebug or any other browser tool can help me on this?
Thanks.
It is because if you place a button inside a form, by default in will act like type="submit".
So just add type="button" to those buttons.
When we want to log-out from the google/gmail account, we click on the profile picture displayed at the right most of the Google bar. The scenario with the pop-up is shown in below figure.
What does this functionality called in jQuery, HTML? I think it's not a modal pop-up as it's not appearing on the existing content of a page and background content is non-clickable. Also it can't be called as tool-tip as it's not showing up on mouse hover, we need to click on profile picture to see the log out button. So what does it called?
I'm asking this thing curiously because I need to implement same functionality in my website. That is when user clicks on specific text the pop-up/tool-tip(for now I'm using these words for your understanding only, may be I'm using wrong words). As I don't know the exact word for this functionality I'm not able to find out such jQuery plugin on internet which would behave the same way.
One more thing is that I want to use a form in this pop-up/tool-tip which would be submitted to PHP using AJAX.
Popover!
Example API from a popular CSS/JS toolkit:
http://getbootstrap.com/javascript/#popovers