How to identify img file which is loaded under network monitor console using selenium - selenium

When we navigate to a page and inspect the page, under Network monitor tab > images, we get a list of file names (Ex. imgge.png) as the page is loaded. How do i idientify the image is present when we navigate to a page using selenium script.
I have attached the screenshot for reference what im exactly referring to.
enter image description here

driver.findElement(By.id("imagefile_id")).isDisplayed();
get the id value of the image and use the above script, it return the Boolean value.

Related

Accessing Image URL on Orchard using razor

I am using Orchard CMS. I am trying to access an image URL on a razor page as per the first image attached.
The output I get through google inspection is also attached as second image. I am simply trying to get rid the square braces so that I access the actual image file
I tried these:
#post.Content.Images.Images.Paths.[0]
#post.Content.Images.Images.Paths.first()
enter image description here
enter image description here
#Orchard.AssetUrl(post.Content.Images.Images.Paths[0])

PhantomJS AWS Browser Tab Title

I have a problem with my browser tab title.
Actually on my website I generate some report using PhantomJS and pull them on a AWS S3 Bucket. I access to them using some link like that : http://192.168.33.120/report/8/1?export=inline
The problem is that my Browser tab titles are like : 1 or 1?export=inline, it display the url and not my PDF file name.
Is that possible using PhantomJS to set a property like title or other think like that to specify the title that I want to show on browser view ?
The title of the rendered PDF cannot be explicitly set. document.title is also not used for the PDF title. Although, qpdfwriter.h has a setTitle function. You can issue a feature-request on GitHub to expose this function if you like.
You can also simply name your reports appropriately by selecting good URLs. That way the PDF title will be a non-issue.

Hotlinking: How do I differentiate between an image in a <img> tag versus an image link?

I want to allow partial hotlinking to images on my website. I want to allow a specific site (Reddit) to be able to show an image from my website on their page, but if they click on the link to the image from that site, it should go to an image viewing page, rather than directly the image itself.
For example:
This other website should be able to have this
<img src="http://mySite.com/myImage.jpg"/>
on their page, and it should show the image. However, if they have this:
Link Text
A user who clicks on that link should get redirected to an image viewing page that contains some html, including the image, rather than directly to the image.
I'm trying to achieve this via mod_rewrite. However, those two cases have the same HTTP_REFERER. Is there anyway for my server to differentiate between that?
There is no way to do such thing! but if second site is your you can put optional query string at the end of URL the distinguish between them!

Chrome extensions: How can I pass form variables to a url in a newly created tab?

I'm working on my first chrome extension, and using an image-based context menu item to capture the URL of a given image, and want to then display that image at a specific URL in a new tab. So, I need to pass the URL of the image clicked on (using srcUrl) to a specific script that can then render it on that page. Is it possible to perform an HMLHttpRequest from within a chrome.tabs.create() call, or must this be done some other way?
Thanks for any help.
You would need to create an HTML page containing that script and put it into your extension folder. Then you can just pass image url to it as GET parameter:
chrome.tabs.create({url: "local.html?img_url=...");
If url parameter is not enough, you would be also able to communicate with that page using chrome.tabs.sendRequest():
chrome.tabs.create({url: "local.html", function(tab){
chrome.tabs.sendRequest(tab.id, {img_url: "local.html?img_url=...");
));
With the request listener in that page:
chrome.extension.onRequest.addListener(function(request) {
console.log(request.img_url);
});

is it possible to do low-level pixel inspection with selenium?

is it possible to inspect the value of a specific pixel in the browser rendered page with Selenium? can i get a buffer of the rendered page as an image?
Also, is it possible to send mouse-scroll-down commands to the browser?
cheers
You can save a screenshot of the entire page and then manipulate the image file