I'm looking for a way to programmatically click the drop-down arrow that appears when we open a specific FB post such as https://www.facebook.com/userxxx/posts/10155300116786742
Can anyone please provide me the code for Visual Basic? Thank you.
Drop-down arrow
in your webbrowser control you can invoke javascript code inside of the requested page by using
WebBrowser.Document.InvokeScript("eval", "some javascrtip here")
that leaves us with the problem of doing the dropdown click with javascript. That you can do with:
document.querySelectorAll("[data-testid=post_chevron_button]")[0].click()
so, all together it end up being
Dim micode As Object() = {"document.querySelectorAll('[data-testid=post_chevron_button]')[0].click()
"}
WebBrowser.Document.InvokeScript("eval", micode)
notice the js code provided might change. You should decide what code is better yourself. I recommend open facebook or any page, in chrome and press F12 ... that is the developer console. You can run and debug javascript there.... have fun!
Related
Firefox 31 broke my Googlebar Lite extension, and I'm trying to debug why. My problem is that mouse clicks no longer register for search suggestions that appear in the auto-complete popup menu (which comes as a part of the Firefox autocomplete textbox control). I'd like to inspect these chrome elements with DOM Inspector, but the popup closes (destroying the anonymous children) before I'm able to inspect them.
How can I inspect a popup element (in this case it's a panel) without it disappearing? Is there a way I can force that kind of element to stay open so I can examine its children?
Inspecting the autocomplete DOM would require hacking deeply into the autocomplete code to avoid making it destroy items before inspecting.
While possible, I'd first look if the autocomplete code changed, so I tried:
Finding the result interface on MXR: http://mxr.mozilla.org/mozilla-central/source/toolkit/components/autocomplete/nsIAutoCompleteResult.idl
Checking the log: http://hg.mozilla.org/mozilla-central/filelog/de8c0f0e74a2/toolkit/components/autocomplete/nsIAutoCompleteResult.idl
Checking out the newest changeset(s) and bug(s).
And indeed, Bug 754265 amended the interface.
So I implemented the interface change, implementing the new API method, and after that the broken stuff works again:
getFinalCompleteValueAt: function(index) {
return this._results[index];
},
I made a pull-request for you.
Also try installing addon "Element Inspector" it allows you Shift + Right Click anything and it pops it up in "DOM Inspector"
https://addons.mozilla.org/en-US/firefox/addon/element-inspector/
I have a news-type website that I am looking to create using N2CMS, but besides the regular operations (being able to see a calendar, viewing lists of news, viewing news details etc.), part of the content in the website is displayed in "modal" popups (similar to the ModalPopupExtender from the AjaxToolkit) inside the page (for example if you click Login, a popup panel appears with the login controls).
My question is: is there a way of adding a handler for a link, and displaying a "modal" popup when the link is clicked? If so, can this be done from the template GUI editor (and how)?
Thank you
N2CMS doesn't have any built-in handlers to create modal pop-ups for links. However, N2CMS does ship with the Jquery JavaScript library. My suggestion would be to use JavaScript in your site template to select and format the desired links with modal dialogs -- but that can't be done from the GUI editor, you'd need to do it in the template code directly.
This is a real 2%er but here goes, I have created a winform in VS2010 with Gecko 2.0.1-0.10 (latest release) webbrowser control, I am using a touch screen to navigate. Sometimes when clicking a hyperlink it will select text rather than navigate, on the DomMouseUp event I want to check to see if there is selected text, if so I want to see if it is a hyperlink and if it is, where that hyperlink goes to. I had a mess around with GeckoSelection but nothing looked obvious. I am looking for a way to see if what is selected within the web browser is a hyperlink, any thoughts?
I've worked it out : for anyone interested in such things, use DomFocus on the gecko control:
m_strInnerHtml = geckSel.ActiveElement.Parent.InnerHtml.ToString();
That will give you the innerhtml of the selected item, from here you can extract the href tag and get the url, navigate to it, hey presto :)
Update: An even better solution is to use (in DomFocus again)
m_strInnerHtml = geckoWebBrowser.Document.ActiveElement.GetAttribute("href");
This will return the actual hyperlink address, one thing to watch out for however is if you're on google for example and select the "Advertising" hyperlink at the bottom of the page, it may return "/advertisingpage/" which must be appended to the original url. Clicking a hyperlink away from google will return the full address however.
Very good behavior gives this call:
m_strInnerHtml = geckoWebBrowser1.Url.AbsoluteUri()
I have created a tab (now in the side menu) using FBML which links to my website. I have added a "Share" button which works, but can't seem to add a "Like" Button. Can anyone tell me the code?
You can't officially... However there is a workaround in using the FBML comments like button.
See: http://blog.elliotjameschong.com/2011/01/03/how-to-add-a-facebook-like-button-to-a-fbml-tab/
watch this, is in spanish but the code works
http://cosasparaelface.blogspot.com/2011/01/colocar-el-boton-me-gusta-en-pagina.html
I am creating a Firefox extension that is somewhat similar to Firebug. There is a panel (or vbox) at the bottom of the browser that allows users to specify colors to certain Html elements. When they click the OK button, I would like these colors to get updated on the current web page.
I have my JavaScript working when I click the button (i am just throwing an alert), however when I change that JavaScript to change the css or styles of an element (by either using document.getElementById or jquery), nothing changes.
Is there something with Firefox extensions that I am missing? Any help is appreciated.
Let me know if you have any questions. Thanks
https://developer.mozilla.org/en/Extension_Frequently_Asked_Questions#Accessing_the_document_of_a_webpage_doesn%27t_work
You want content.document.getElementById() and similarly for every other construct you use.