Using VBA to click a button with no ID - html

I'm trying to use VBA to navigate to a website and then extract some data. So far I've been able to navigate to the website and, but I can't figure out how to click on the buttons I need. Based on the research I've done, using querySelector is a much better option than using getElements.
When I inspect the button I'm trying to click on it brings me to the following line in IE's DOM explorer
<INPUT width="80" class= "button" onclick= "updateSummary();" type= "button" value="Apply Filters"></input>
Based on my research, I've got the following:
.
.
.
Ie.document.queryselector("input[value=Apply Filters]") (0).click
But I get a
runtime '438' object doesn't support this property or method.
I'd also like to be able to click on an "Export to CSV" button, and the html code has an href component and a source = "dynamically changing code based on the day" component.
Would it be possible to click on the export to to CSV button and either open the file or save it in a folder?
Thanks so much for the help!

Two things:
As mentioned in comments, drop the zero as you are not dealing with a nodeList. querySelector returns a single node which is the first match for the specified selector, or null.
You cannot pass a selector for attribute value that contains spaces without enclosing within ''
ie.document.querySelector("[value='Apply Filters']")
You could also use:
ie.document.querySelector("[onclick='updateSummary();']")

Related

Text area/input hard to select/edit for some cells (tabs/empty spaces?)

So I have Create & an Update view with Django. Both use the same template for the form. (It doesn't seem to be a Django problem perse, but in case it turns out relevant...)
With the CreateView, I can easily click into a textarea widget and edit its value. With the UpdateView however, I seem to need to use a bunch of click before somehow I manage to edit the content of the area. I have compared the html/css in both cases & they are exactly the same.
Upon further inspection, it seems that the imported data contains tabs in some empty fields (hence why it only appends in the UpdateView). So the issue appears to be that when I click anywhere in the input/textarea, the tabs make it hard to actually focus/select the cell. That may be why random clicks (or double-clicks to select the tab?) appear to allow me to edit properly.
I'm unsure if the tabs originate from the source data somehow, or just got added along the way. Of course I'll probably figure out a way to clean out that data.
Is there a quick css/jquery fix for this? Some sort of $('input').on("click"...) handler I could use? Of course one option would be to clean up the source data. However if for whatever reason they've been living fine with those in their previous system, I might just leave it & go for a quick fix, should one exists.
Something like this:
<textarea name="descfr2" cols="40" rows="10" maxlength="60" id="id_descfr2"> </textarea>
https://codepen.io/logikonabstractions/pen/GRWPROO
You could use the focus() method from jquery (https://api.jquery.com/focus/).
Try to add the event on your cells so that the input inside became focused on click:
$('.cells').click(function(){
$(this).find('input').focus();
}
I would do something like that (if you can select all your cells with some class attributes)

Selenium VBA - Won't tick tickbox

I have a spreadsheet that is scraping some data off a website.
One part of my program is to tick a tickbox.
I'm able to find the element without any problem using FindElementbyCSS but clicking it doesn't tick the tick box.
this is my code
.FindElementByCss("label[for='chkStdDev1']").Click
This is the tickbox (the first one, second one is ticked by default)
and this is what I see when I inspect the element
Was nice and happy when I managed to find the element correctly, but now it's driving me a bit insane as it won't tick!
You are trying to check the label rather than the checkbox type input.
Use
.FindElementById("chkStdDev1").Click

PhpStorm combine multiple Predefined Live Template functions

I have a project where my files are in "lisp-case" (hyphen delimited) and I would like to use the filename as a variable in a live template, but it must be converted to CamelCase first.
I found out that you can set the expression fileNameWithoutExtension() under "Edit Template Variables" and there is also a function called camelCase() which should be able to turn my filenames into CamelCase. But I cannot figure out how to combine those two. I tried doing camelCase(fileNameWithoutExtension()) but that does not work, unfortunately.
Is it possible to achieve this some other way?
camelCase(fileNameWithoutExtension())
It's a correct syntax.
Is it possible to achieve this some other way?
Please ensure that Skip if defined checkbox is checked for this variable.
If I try to wrap fileNameWithoutExtension() inside camelCase() and press enter to save the entry the window is closed but the change is not saved
It's an IDE bug (https://youtrack.jetbrains.com/issue/IDEA-132965 -- supposed to be fixed in current 2017.1.x version).
In any case: either press Enter before leaving the field ... or click on OK button straight away (you may then reopen this window to do further changes).
Also, when editing the field it's rendered like a select box which is kind of weird. Maybe it's a bug in this specific version. I'm on PhpStorm 10.0.4 for Mac.
Not a Mac user here .. but it is an editable drop-down box indeed (it lists all possible functions).

passing a variable inside a variable to an angular directive in html

I am doing a signup form with a few steps, made with angular material tabs. I have 5 tabs each containing a few inputs that the user should fill in. I also have 2 buttons below the tabs, one to get to the next tab and one button to get to the previous tab. I want to disable the upcoming tabs and also disable the button that takes the user to the next tab until the user has filled in the the tab he is on properly. I want the user to be able to go back and change the information that is already filled in on the previous tabs, and when all the tabs are filled in properly a send button is shown. So, that's basic functions for a multi step signup form.
I have managed to do the basic functions for the buttons and the tabs with ng-disabled and ng-hide combined with changing the value on the variable tabNr in my controller, like hiding the previous-button on the first tab and hiding the next-button on the last tab, and that works fine.
When it comes to hide the next-button based on if the form is filled in its a bit more tricky. I am able to disable the next tab by validating the form on the previous tab like this: ng-disabled="!tab1Form.$valid", so that's hard coded and works fine.
The previous- and next-buttons, though, are the same for all tabs and that is the tricky part, so I can't just disable the button if a form isn't valid because the button does not know which tab that is active. I have tried to make a function in the controller but then the problem is that the valid-variable is just a thing in html and I cant evaluate it in the controller.. As far as I have tried and have understood.
So this is the next-button:
<md-button ng-click="FormCtrl.tabNext()" ng-disabled="FormCtrl.tabNr >= 5 || !tab{{FormCtrl.tabNr}}Form.$valid" ng-hide="FormCtrl.tabNr > 4">Next</md-button>
Each tab has this, with it's own number:
<form name="tab1Form" novalidate>
What I've tried is to change the tab, that should trigger the disable, by using angular:
ng-disabled="!tab{{FormCtrl.tabNr}}Form.$valid"
The browser seems to change the number, and it works for the first tab, but on the rest of the tabs it does not disable the button even though it should, like if the browser does not evaluate the variable properly. I hoped that it should work because I cant think of another way of doing it with these variables...
Does this way of using angular simply not work or am I doing anything wrong? Does anyone have a solution I could use?
In your controller
function Controller($scope){
var vm = this;
vm.form = $scope['tab' + anyNumber + 'Form'];
}
then in your html
ng-disabled="!FormCtrl.form.$valid"

html input file action after file selected

I am in a predicament with input files. The project I am working on has added a jQuery extension that masks all input types and makes them more 'vibrant'. However it has also caused a lot of trouble in the updating of what is listed in these inputs. One such problem is the input with type file. It currently will not change what is being uploaded after the very first selection. So I am wondering if there is a command you can use to do something after the user has selected a file (pressed the Open) button.
I'm not exactly positive on what you're asking for but: you can bind logic to the input's onchange event. This will run the code attached to it after the user has selected their file(s) and pressed the "Open" or "Cancel" buttons.
Here's an example using jQuery (since you've already stated you're using it):
$("#yourFileInput").change( function() {
alert("Hey, you changed me!");
});