I only want to display html from a url and avoid loading images when a user clicks on any link on the webview. I have already set .setSupportMultipleWindows() to true. How do I accomplish this using loadDataWithBaseURL()?
Related
I am doing an automation for a website and I have this drawer Menu Panel that I want to open verify some elements in it then close it or hide it.
I am stuck now while trying to close/hide this drawer.
However, in the HTML I found this when it opens:
"is-visible" added to class name
Tag aria-hidden="false And when its closed/hidded"
"is-visible" removed from title
Tag aria-hidden = true
Here is the code for login and then open Menu and check Logout is displayed
login.SuccessfulLogin(testdata);
login.clickLink(By.xpath(testdata.getParam("MenuLocator")));
login.WaitForElementVisibilty(By.xpath(testdata.getParam("loginLocator")));
login.compareValue(testcase, "", expectedResultMap.get("MenuLoginTxt"),
driver.findElement(By.xpath(testData.getParam("loginLocator"))).getText());
// here should enter the code to close the menu!
log.info("User Logged in Successfully");
See screenshot
(Menu opened on the Left-side & HTML code highlighted on Right-side)
Website you are checking is accessible from network so i checked how it works. You just need to click outside of menu area. Correct element is div.mdl-layout__obfuscator.
Using java you can do this like this:
driver.findElement(By.cssSelector(".mdl-layout__obfuscator")).click();
Note: there is only one element with this class name on this page so this is sufficient. You can use any other selector type, not necessarily css selector.
My main goal: When i click the link, a new browser window should be opened and displays the content of entire log file. And the window should not have an address bar and navigation buttons (Back, Forward).
Is there any approach to do this in Spring-MVC project?
Here is what i am doing now:
When i click the link, the controller will be called with a parameter logName.
Now the controller have access to get any kind of details of the log file like content, path, etc... I am setting all these details to an object and sending back to JSP.
Here i am not sure how to open a new window and display the content of the log file in that window.
Please suggest me an approach on this!!
It would be very helpful for me if you can share me with some examples...
Spring or JSP have nothing to do with it, the only way to force user's browser to open a link in a new tab is to use client-side Javascript. window.open() allows configuring the popup to hide certain interface elements (see all options in the documentation)
Your code would look something like:
<input type="button" value="Show Log" onclick="showLog(logName)">
function showLog(logName) {
var url = "/path-to-your-controller.html?logName=" + logName;
window.open(url, "LogPage", "toolbar=no,location=no,menubar=no");
}
However, I don't think using a customised browser popup is a good solution; it's been disappearing from the web for a reason. It would be more elegant to fetch raw data using AJAX and display it in a JS popup: it wouldn't interfere with user's page navigation (you tagged the question with jQuery, you could use jQuery UI for that).
What is more, I wouldn't be surprised if window.open wasn't supported by all browsers in the same way† - something to keep in mind if you're targeting a wider audience.
† seems that Chrome ignores location=no, for instance
Hello and thanks for taking the time to answer my question.
I have a custom portlet with a typical file upload html element. However, I was told that the user should be able to select already uploaded images and not upload new images. At the moment I am loading a web content display portlet on a random page, click on image icon in the rich text editor and copy the link in the javascript of my portlet, which opens the image gallery in a pop-up, in order to access the image gallery. However, this is not a plausible solution for production and I was wondering how I can load the image gallery from a custom portet. I need to be able to see the image gallery open in a pop-up with a user clicks Select an Image button.
Thanks in advance!
This code is enough to do this:
List<IGFolder> listIGFolders = null;
if(selectedFolderId!=0){
listIGFolders=IGFolderLocalServiceUtil.getFolders(groupId, selectedFolderId);
} else{
listIGFolders = IGFolderLocalServiceUtil.getFolders(groupId);
}
List<IGImage> igImages=IGImageLocalServiceUtil.getImages(groupId, selectedFolderId);
I'm getting anchor tag from database like below. displaying using TextView
Click here <a href='http://example.com/202'>information</a>
till now it is fine i'm displayng it using (Html.fromHtml(PostInfo).
Now my question is when i click on this anchor tag it is opening browser to display page but i've that page in my application activity. what i need is i want to change that anchor tag url to redirect my application activity.
For Open Browser Within Your Application
Create a new Activity which have a web view and pass the URL to that Activity's web view when you click on anchor tag.
Hello i need some help to figure out what to do .
I am trying to create a page that has a list of events and each time I click one of the list's elements a different photo gallery should load. I did this by loading each gallery in a different iframe.
The problem is that right now the only thing it dose is loading the first galery and the other ones don't seem to manage loading any pictures (if I refresh each frame than they work fine)
What should i do?
This is the script I used in the webpage
You can find the page source here http://www.avantsolutions.ro/exp.txt
You can try with jQuery UI Plugin instead of iFrame.
On clicking of list item(West pane), you can load center pane div with corresponding images.
Check the examples here.
You can use jQuery's load function to load a gallery via ajax.
$(selectorForYourGalleryDisplayDiv).load( url, [ data ], [ complete(responseText, textStatus, XMLHttpRequest) ] )
Load will take the result from url, if you need to pass it data it will use a HTTP POST, and replace the inner html of the wrapped set it is called on.
I don't know the internals of your architecture, but the main process is giving your galleries Ids, pass them to the server using the JSON format, your code will use that id to get what's needed for the gallery, render the html and return it.
load will drop that html into the elements that match selectorForYourGalleryDisplayDiv.