On a webpage (which I cannot change) I have a link like this:
<a class="PSHYPERLINK" href="javascript:submitAction_win0(document.win0,'PRCSDETAIL_BTN$0');" tabindex="94" id="PRCSDETAIL_BTN$0" name="PRCSDETAIL_BTN$0"> Details</a>
In my code, I put this:
browser.frame(:index, "1" ).link( :text => "Details" ).click
What happens is that the link is not clicked, or at least this makes no effect, but I receive no error. The script simply continues. It is interesting that on the same website I am able to click other links, even if they use JavaScript like the one above. Example of link for which FireWatir works:
<a class="PSSRCHRESULTSODDROW" tabindex="32" href="javascript:submitAction_win0(document.win0,'#ICRow2');">TESTQUERY</a>
Maybe you need to fire JavaScript event: How to find out which JavaScript events fired?
Are you sure you are clicking the correct link? Link text is " Details" and you are clicking link with text "Details" (please notice space in front of the first string).
Related
I am trying to make a Chrome extension, everything is going well, except that before the content of the popup is filled with javascript(XMLHttpRequest - asynchronous) I see a small blank popup that has not yet been filled.
That is,
Before this loads
I see this
In the code, I am simply using document.getElementById to fill up the HTML. So it looks like
HTML:
<body>
<div id="status"></div>
</body>
JS:
document.getElementById('status').innerHTML = 'content of the request';
I see where this is coming from, since the popup is originally blank it shows that little blank box before javascript(XMLHttpRequest) is done. But How can I make it wait until the request is complete?
You can't manually display the browser/page action popup. This feature will not be implemented : source.
The most simple solution is to add a loading wheel gif to the html of the popup. It will display the popup until the content is changed by your code when the request is complete.
Another solution is to display a popup (not a browser/page action popup) when the user click on the browser/page action. This way you can wait for the request to display your popup.
I have the following variable appended to 'QTextBrowser'. It does appear as a link, but when I click on it all the text in the 'QTextBrowser' disappears. All the function the 'anchorClicked' signal is connected to does is print something in the shell so that I know that the signal was received.
word = '<a href>' + '<span style="background-color:#C0C0C0">' + word + '</span>' +'</a>'
self.textBrowser.anchorClicked.connect(self.test)
def test(self,argv_1):
print('!!!')
Probably what's happening is that the text browser is attempting navigate to the href specified in the anchor. But since the href is empty, it just shows a blank page.
If you want to stop automatic link navigation, try this:
self.textBrowser.setOpenLinks(False)
(NB: the anchorClicked signal will still be sent when the link is clicked).
You can also prevent this behaviour by calling self.textBrowser.setSource(QtCore.QUrl()) in the function connected to the anchorClicked signal (in your case test()).
For an example, see what I did in my answer to your other question here: https://stackoverflow.com/a/19475367/1994235
This allows you to still have some links that take you to other pages, and some that don't (you call the above line of code to prevent the page change, only when certain urls are passed to your function)
Use html2text to download the URL to matching directory for every link on the page. Reformat as HTML, adding headers and rewiring the links. Then do this recursively every time you click on a link and you effectively have a working web browser. The links will actually work. I would like to see someone do it in less than 3 pages if they can.
I wish to add a new menu item/link (e.g. "Stack Overflow") at the end of the menu in the screenshot below.
The new link URL would end in the community_uuid e.g. http://example.stackoverflow.com/some-page#community_uuid
Is there any good documentation available to show how this is done?
Immediately I thought of three things:
1 - Custom CSS for a community, so you could somehow add/change or maybe create a landing spot for a dom manipulation event which adds it.
In order to change the CSS, You should look at:
http://infolib.lotus.com/resources/oneui/3.0/docPublic/components/menu.htm
It's the navbar role.
In a folder such as /local/con/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/conServerCell/Communities.ear/comm.web.war/nav/common/styles/orangeTheme/
2 -
You may also want to look at /local/con/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/conServerCell/LotusConnections-config/widgets-config.xml
specifically
you could add a StackOverflow widget, when loaded it automatically opens up a new window, and transfers the person back to the previous page. ... a little bit of a kluge...
3 - Look for /local/con/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/conServerCell/Communities.ear/comm.web.war/nav/templates/page.jsp
find the line
<div class="lotusMenu" id="lotusMenu" style="display:none;" role="navigation" aria-label="Main navigation"><div class="lotusBottomCorner"><div class="lotusInner">
<div id="lotusMenuTree"></div>
</div></div></div>
You could modify the very end to add some custom link for you.
Just some quick thoughts...
Using Watir I have been able to isolate this button element:
<BUTTON id=authButton class=commandButton onmousedown="$('newOrder:hiddenAuth').click();">Authorize Payment</BUTTON>
Here is my watir code:
$browser.div(:id, "rSide:j_id750_body").table(:index, 0) [1] [0] .button(:index, 0).click
I was able to see I'm on the <button> by using watir's "flash" method to highlight the button. For some reason I am unable to actually click the button. I think it might have something to do with the onmousedown code but I really don't know. Any help would be greatly appreciated.
The button is wired up to do some specific action when it see's the onmousedown event, so if .click is not working, the next thing to try is firing that specific event, instead of using the .click method.
If that doesn't work try forcing the javascript to execute the newOrderLhiddenAuth script.
oh and FYI for your developer, they may want to get into the habit of using lower case for their HTML tags
"the World Wide Web Consortium (W3C) recommends lowercase in HTML 4,
and demands lowercase tags in XHTML."
I have a problem with the following HTML:
<a href="javascript:document.formName.submit();" target="iframe">
Where formName is the name of a form inside the iframe. I would like the browser to navigate to the page "javascript:..." in the iframe, so it executes the javascript on the current page in the iframe. My problem is that the browser will attempt to execute the function and use the returned result as the url. Of course there is no form to submit on the current page, so I just get an error.
Cross domain iframes are no fly zones, you won't be able to do anything with or to the DOM inside of a frame on a different domain. Even if the user clicked the submit button inside the frame, your page would not be able to get the new url back out of the frame.
In this case, you can do it by reaching inside the iframe:
<a href="javascript:window.frames[N].contentDocument.FORMNAME.submit()">
(that may not be exactly the right incantation). In general, you should do this with an onclick handler for the hyperlink, that invokes a function defined by the iframe's document.
EDIT: There is NO WAY to make this work cross-domain. It's a violation of the browser's security policies.