Google Tag Manager variable returning null for image URL using DOM Element - magento-1.9

I'm trying to scrape the image url from a product page on magento but I don't know why is returning "null".
This is the URL I'm trying to scrape:
Chrome Dev Tools Screen with the image URL to scrape
After that I checked the selector with the document.QuerySelector() function
Result of document.QuerySelector on Chrome Dev Tools console
This is how the variable is configured at Google Tag Manager:
Google Tag Manager Variable Configuration
Here is the variable returning "null"
Google Tag Manager view mode showing variable returing "null"
I've double checked every step I did and I really didn't find what I am doing wrong...

Related

What happens when I put an image URL to the src attribute of a script tag?

I'm working on embedding pixel tracking on our pages. We have a setup wherein the users could enter up to 4 pixel tracking URLs. Basically, for each pixel tracking URL, I just need to append a script tag with the URL in its src attribute.
For example:
URL: https://code.jquery.com/jquery-3.6.1.min.js
Then the script would be:
<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
But what happens when the URL is an image? I tried this and it's giving me a "refused to execute script" error due to the mime type. I kinda expected this since it is an image and I'm alright with the error since the image call is still being logged in the network and was actually successful since it has a status code of 200. I just need to be sure that the image will still be logged in the network with a successful call. Does anyone know if there are any instances that the browser will block this kind of scenario and will cause the web service call for the image to fail? Thanks

Force chrome to open url instead of search

When developing and opening custom urls you always have to type **http://**localurl.local/ in order for Chrome to open page and not google search.
Is there some way you can force google to first try to lookup if page actually exists? And if I already have opened url and append something to string I'm being again redirected to google search which is very frustrating.
If you're not following me see this gif:
preview

Using Scrapy response, XPath element doesn't exist, although Google Chrome Inspect Element shows that it does exist

I am encountering a problem in which elements that I am trying to select using their XPath do not exist according to Scrapy response. However, the when I inspect the same page on Google Chrome, the element DOES exist.
This problem is occurring on a LinkedIn scrape after using LinkedIn advanced search and getting to a results page. I want to scrape links in the results container.
For example: On the results page for a search on "John," there should be a div element with id="results-container" according to an Inspect Element on Google Chrome. When I use Scrapy response.xpath('//div[#id="results-container]'), there are no selectors returned.
url of result page: https://www.linkedin.com/vsearch/p?firstName=John&openAdvancedForm=true&locationType=Y&rsid=4319659841436374935558&orig=ADVS
Did you try to look up the URL you provided in a private session window of your browser (sometimes called incognito mode)?
If you do this you see that you get a registration form for LinkedIn.
As alecxe suggests in his comment try using the LinkedIn API (it is REST) and you can get XML responses which you can parse along to gather the information needed.
Alternatively you could try to log-in with Scrapy and store the authentication credentials and repeat your request (but I would use the API anyway).

Redirection with chrome extension

I'm really new to the chrome app dev part. I want to know how can I make a chrome application that will read my current URL and redirect me to another.
For instance if I am on www.stackoverflow.com and user clicks on the extension icon then it will redirect him to wwww.stackoverflow**NEW**.com
Thank you..
Follow these steps and you will be good.
Create a background script and define an entry for background script in manifest.json
In background script, define a handler on chrome.browserAction.onClicked.
Inside that handler, extract the url of current tab and check if it is the expected url, then just change the url of that tab.

Google Chrome extension - to open new tab directed to url when a certain url is searched in current tab?

I am very new (started today) to writing chrome extensions but need to write a 'fairly simple' one for tomorrow...
I am really struggling to get my head round it though!
I need to write an extension that opens a new tab or window (whichever is easier!) directed at a predefined url is opened when a certain URL is searched in the current.
An example of this would be if the user typed in www.facebook.com I am trying to get the extension to then open a new tab/window with www.google.com in.
Any help would be much appreciated!
Thanks
Will
In your html of the extension you can specify an anchor tag for the action button which opens a new tab like this
content of the anchor
or if you want to do it programmatically you can
window.open('http://google.com','_newtab');
You cant get at the contents of the omnibox unless you use the omnibox api, which means they have to specify your keyword first before your extension can get at the contents. You could make it open another page once they have gone to a url. You could use a content script that has a matches field that matches the page your interested in and then open a page accordingly.
Content Scripts
http://code.google.com/chrome/extensions/content_scripts.html
Tabs
You can use the tab api to get the current tabs details if your not in a content script. If you are in a content script you can use window.location as stated by Encore PTL. You can also use the tab api to open a tab.
http://code.google.com/chrome/extensions/tabs.html