Need help finding button id/class etc to click - javascript

I'm writing a Python script to enter MS Teams and join a class based on a schedule, and have very little to no knowledge of markup languages/ js.
This "Join" button is what i want to click.
When i click inspect on it, I get (Highlighted in blue):
My code to click the button:
driver.get(physics)
driver.find_element_by_xpath('//input[#class=""]').click()
need help finding the class/id/ anything to be honest, to click the button.
The rest of my code: code

You can find the details of the button from below the screenshot.
But it is not recommended to use the classes for the same as they might be repetitive on the entire page.
The button is highlighted in the inspector tools.
Note: class root-160 is a dynamic class and you might not wanna use it. It will change per meeting/pages.
Screenshot of button component

Related

click html button no onclick/link

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

Javascript: Checkboxes on Forms and output

I run a large Discord server and I'm making a channel for people to post template information about their online groups. To make complying with the template either, I've created a single HTML page which takes the information that goes in the template and regurgitates it into a box on the bottom of the page with some nice bolding and italics where needed already for copy/paste.
Unfortunately, I don't know Javascript so I'm just trying to piece things together and learning as I go. (I'm learning other languages but not this one in school.)
For some reason me trying to format code on here isn't working so I can't paste what I have so I'll just try and explain it.
I'm using oninput="groupNameFunction()" and I'm having the javascript grab the user entered data as they type it via grabbing the ID of the input field then regurgitating it out in the innerHTML of another element. And it works great.
But checkboxes (and probably radio buttons) don't work with oninput (for pretty obvious reasons) but I've been able to get onblur to work to some extent.
The problem is that I'm a beginning coder and I don't quite know or understand how I'll take all the results from all the checkboxes and regurgitate them out into a nice list when there are many IDs and many choices and it doesn't seem sensible to try and write all choices from a single thing into their own function, or how I'll handle the same thing with radio buttons.
I can't find any examples in stuff like W3 tutorials of this being done, it's probably that I just don't know the language to google it correctly.
Could someone point me in the right direction on how to make this work?
here's a little fiddle for you to play with. (press F12 to open developer tools and see console, you'll find logs there)
for radio and checkbox inputs you have change event, it triggers when user check and uncheck the box. bare in mind that you need to have same name="friendly-name" attribute on radio buttons in order them to work as expected.
for the "text" filed use input event.
don't add inline events in HTML, it's bad practice, add them via JS. from JS you can select all your inputs by ther class, name, tag name etc.. and add event handlers (you can find everything in the fiddle).
hope it helps. :D

Webscraping automation How to simulate click of HREF link where no link TAG is there?

I am trying to scrape/automate a certain website but struggling to know where to start - I know you can point me in the right direction here - in my example - selecting a horse odds.
If you follow this link http://www.oddschecker.com/horse-racing and then click on any of the races, I want to be able to automate on a race meeting - the user clicking of the odds of one of the horses at one of the bookmakers but there is no anchor or HREF tags or any link for me to tap into programmatically.
Here is an example of what inspector throws up:
<td class="bc bs o" data-odig="5.5" data-o="9/2" data-hcap="">5.5</td>
I want to be able to simulate the user clicking on that 5.5 in the TD.
Many thanks.
Simon
If you can click on this and it actually fires an event, then there is javascript listening to that event. You can get the Javascript to execute with JQuery:
$("td [data-odig='5.5']").click();
(Obviously the selector should be updated for whichever element you want to click.)
Reference: https://api.jquery.com/click/
So you need to be able to run your own arbitrary JavaScript in the page, and then you can accomplish this.

Bookmarklet to select all friends and add them to an event on Facebook

I am trying to make a bookmarklet to allow me to select all my friends in the dialog to create an event on Facebook. Examining the source with Firebug shows the following:
The div container for each person gets a new class label of
selectedCheckable
when it it is clicked, So I have written this like of JS to try and select all the div's and give them this class:
$(".checkableListItem").addClass("selectedCheckable");
This works in selecting them, however when it comes time to press the "Save and close" button, the changes do not seem to have any effect in selecting all the friends to add to the event. It seems that FB has a different way of marking the friends that have been selected to add to the event. Would anyone be able to point me in the right direction so I can accomplish this? Thanks in advance, RayQuang :)
May I advise instead of making your own couldn't you just use one of these Greasmonkey scripts?
http://userscripts.org/scripts/search?q=facebook+invite&submit=
That's what I was doing and it was working for my events. Let me know if it works for you.

button toggles between states

I was wondering if anyone knew of some code which implements two buttons where one is just plain text and the other is say a link. When the user clicks on the link the other text becomes a button and vice versa when the user clicks the link again.
Think of it like this: One link is active the other isn't. One is a listview link and the other is a gridview text and when you click listview that link becomes text and the gridview text becomes a link. Does anyone know of an example that implements this kind of behavior or can someone show me an example in jQuery?
This will do it for you: http://jsfiddle.net/u9zfT/
Let me know what questions you have. This is pretty basic jQuery, so I'm not sure where you're getting tripped up.
I would put the text in a span with a particular id. When the link is clicked the .html for the span changes to a button. Clicked again and the span is changed back to text. Let me know if you need some code and I'll put something together for you.

Categories