Location.href works strangely. Why? - json

I want to implement the function of moving to the corresponding link when I press each td. The link is stored in the Json file. However, when I checked this code with live server, I found that it moved to one of the links even though I didn't click it. How should I modify my code?enter image description here

Related

Is there any way we can directly connect to the function without wanting to click the button i.e., when ever the page loads the function gets called

here is the Html button i want to disable the click function, reducing the extra step so that the function gets called whenever the page gets loded in the browser.
i want to scrape the data(info that comes after clicking the button) from this html file.
OR
Suggest me if we can dirctly call this JS function In Python
I tried Js2Py but cannot translate the Js File.
i have not tried anything as im not fimailar with html.
i'm supposed to modify the code according to my preferences and im a novoice in html.
i searched in google but couldnt find any relaiable source.
the answer is onload function on the Body tag of html instead for onclick it took a while to figure out.
before:
After:
.
.

Google Tag Manager Image Clicks

I am using Google Analytics on a Sharepoint site. On the main page, we have an image in an image carousel that once clicked will bring you to a different page on the site. I have tried everything to track clicks on this image in GTM - click url, click ID, css selector, etc. I can not figure out why my trigger never fires. I have attached the
image, what pops up when I click inspect, and variables that show up with the click in GTM preview... (This is the second half of the variables in preview).Three images total.
Good job on including all the relevant debugging info.
Judging from your inspect, you're looking at the image.
However, judging from your click event inspection, the click lands on an a.
I don't see the a in your DOM on the screenshot, but it may be either dynamically added, or just outside of the screenshot.
No matter. Let's start to carefully debug it. Make a trigger that would be triggered on anything that matches a. That's just a debugging trigger. Make sure it triggers on your image clicks.
Now, let's just make a simple CJS variable that would console.log({{Click Element}}). No need to use it anywhere, just make it. Go to the debug view again, try clicking the banner again and look in the console for something that would look like this:
See that pretty element? Now the wonderful dev console allows you to copy JS path to this element and do whatever you want with it. Mainly, comfortably and quickly test CSS selectors against this element. I suggest changing the selector JS console generated. It should work (unless the page is too dynamic), but it would be fragile. Having the element, however, you'll be able to make your own selectors.

Can't click on obj or link for payment in pop-up cart

This problem is specification on RobotFramework(Selenium) language.
I would like to Click on button ("i.stack.imgur.com/PTNYl.jpg") after confirm purchasing
For clear information please see below picture with ordered number
Select 2 items.
Click "สั่งซื้อ" (confirm purchasing).
Pop-up of cart will show about description and Payment button image.
(Click)
Website : "www.tarad.com/product/5807261#cart"
Code : (saved to .txt and run on Command Prompt)
Open Browser http://www.tarad.com/product/5807261#cart chrome
Select From List By Value product_qty 2
Click Button f_buy
Wait Until Page Contains Element xpath=//*[#id="flyout_cart"]/div[6]/a/
Click Link xpath=//*[#id='flyout_cart']/div[6]/a/span[#id='btn-payment']
(click)
I can find this pop-up cart description, but can't click on button for payment, moreover, I try using Click Image, Click Link, Click Element with payment button xpath that got from Chrome Browser.
I apologize about my English writing and thank you to your attention.
Don't use the Click Link and Click Image, if you are not sure the underlying element is that type - use the general Click Element. Looking at the locator you've specified, the target is a span, so Element should do.
Regretfully I cannot open the site right now to check the html (mobile...), but as far the locator you are using:
do not use indexed paths - the div[6] up there - if the page structure changes just slightly, they can easily brake (which is probably the case with your run)
try not to use direct descendants (the single /) except if you're not sure the structure will remain the same in the long run - they are much faster than "any descent down" - i.e. //, but again, if the structure changes in a future build, they will break. For good or bad, these two negatives are what browsers generate when you ask them to create an xpath
finally, I see in your sample the target span has an id attribute - that is (almost always) the safest and fastest locator strategy to use. So remove everything before it, and address the element as "id=btn-payment"
E.g. change the last call to
Click Element id=btn-payment
Hope this will resolve it for you

Buttons visible on all tabs when copied

When I'm in Access and using a Tab Control, if I copy a button on one tab and paste it to the same tab, this button becomes visible on all tabs. In fact, I think all controls do (I know it happened with buttons and labels).
Is there a way to fix this, or do I have to delete the copied controls and re-draw them on the tab they're supposed to be visible on? Is there a setting that fixes this? I've got a few pages where it'd be handy to be able to copy a chunk of controls and paste them onto a different tab.
This is an old issue that needs to be closed out. The OP #Johnny Bones talks about his answer in the comments but never posted what he did to fix it as an answer.
The answer is that the object was pasted in at the wrong level, the form level. Form level objects are seen on every Tab Page.
To fix this
Cut the object again
Select the Tab Page you want the object to live inside
Paste it there
Move it to the correct location

Chrome - type=file drag and drop

I have a weird situation. One of my users is using functionality of Chrome (current version, 49, 50), that he drags and drops a file from his folder on local computer to normal input type=file button in a form on the webpage. Once again, let me stress it even more, its normal html input, no fancy javascript, no drag&drop events and handlers, nothing like this. It just takes the name of the dragged file and puts it into the input field, as like he selected it via "normal" way, opening the file select window, locating file on harddrive, selecting the file and confirming.
In some specific situation, this stops working (while doing some edits in the page via javascript / ajax), and I need to "reenable" it.
But, and that is my question, I haven't found any documentation of this "feature" in Google Chrome (or maybe some other browsers as well, I don't know). Why it works, how it works, how it should work and what to do if it stops working :) Does anyone has any experience with this ? The only way how to "fix" it now is to reload the page. I'd love to solve it ... :)
EDIT 1 : I just did a quick test, it works and bugs the same way in Firefox on Win. It doesn't show any error in dev console or any message, it just doesn't add the file as expected.
I've found it. The previous discussion with deceze pointed me to test the javascripts I have on the page, that do not "interfere" with the input type=file ... they weren't any such scripts, but I've found that after doubleclick on the table (that I'm using for editing) this script is being called
$(document).bind('drop dragover', function (e) {
e.preventDefault();
});
and there wasn't any unbind action when table is saved ... this caused the drag and drop everywhere on the page to stop working after the edit.