use htmlunit how to get modal dialog element - modal-dialog

I want to go to the website https://console.mobra.in by htmlunit tool, but login input in the modal box, how to get username input element or login form?

Use the queryselector method in HTMLUNIT.
usernamebox = currentPage.querySelector("[placeholder='username or email address']");
passwordbox = currentPage.querySelector("[data-ng-model='user.password']");
To get the above CSS selector, you may install chrome extension 'CSS Selector' of using the selectorgadget.
If it works, please tick it as answer, or otherwise please leave a comment below.

Related

Cant find the right xpath on a website

I am using selenium webdirver to log into a website and click a couple of buttons. The website that I want to connect to is twitch.tv. I can get it to click the log in button on top but cannot send keys to the username or password. It gives me an error when I try to use the username xpath of
//*[#id="loginForm"]/div[1]/input
and the password xpath
//*[#id="loginForm"]/div[2]/input
Whenever I try these xpaths I get a no such element exception.
If someone could help me get the right xpaths for these elements that would be great.
The login form and it's inputs are inside an iframe. Switch to it first.
Java:
driver.switchTo().frame("passport-login");
Python:
driver.switch_to.frame("passport-login")

how to send facebook message automatically without api

guys
now i knew how to send message without using facebook api,
i could use url to fill the message textarea in facebook's website
www.facebook.com/messages/[user_id]?msg_prefill=XXX
but here i'd like to know how to send this message automatically
in April, i found a way to click "send" button automatically (find "send" button in html text and click it),
but now facebook hide theses html text so that i can't find this button in html text.
Therefore, can anybody provide some ways or point to send message automatically.
thanks
Use the console in you browser (usually F12 to open) firefox console is the most powerfull, your console should have a command like "element inspection" or similar, use this tool to analize the button you want, read ing the code you should find someting like "on click" or simsimilar, after this you will find a java command to push the button. Anyway to do this kind of stuff without being a programmer,use selenium IDE, very easy,only for firefox,you must download it from firefox as add on. Good luck!

Visibility change on div with time (Contact Form 7)

I am using WordPress. My contact form plugin is "contact form 7". If your email fails or succeeds, it says sucessfull or not sucessful. I want to attach javascript to it and locate it in middle of my contact so if it fails box opens up says it failed and it disappears, samething for success. I also would like page to change to homepage if mail sent successfully.
If you want this only for the normal use of the form, and not for some fancy special feature - Contact form 7 already have this function .
The default message is (red box ) "Failed to send your message. Please try later or contact the administrator by another method."
you can change this message in the settings.
seems like this could be done pretty easily with jQuery, no? just look for the submit button to be clicked, validate, and then run your actions.
you could either use an alert, or have a hidden div on the page that you change to display:block, throw a timer on that to hide it (or a close button), and just set the html text to 'success' or 'fail' respectively. then when the div is set to close, and was successful, throw a url redirect.
i know that is pretty vague, but not sure of your level of expertise.

What is the easiest way to open a popup window to send an email?

What is the simplest way to open a pop-up window, sending it information from the current page, allow the user to fill out a couple of fields and send an email, and then return to the original window as soon as the email was sent - using Coldfusion?
If you are using ColdFusion 8 or higher then I will suggest you to use CFWINDOW which will be simply div and can load content through ajax or just pre populated div can be convert to cfwindow and use modal version so it will not let user to use main page content. Also on send of email you can close cfwindow using javascript.
If you are using lesser than 8 then same thing can be implement using Fancybox or lightbox as well.
If you want to use native HTML, my best advice is better use modaldialog box. After that, passing parameter from modaldialog box and display at parent page.
I ended up using a simple javascript Window.Open, passing the parameters in the url.
Maybe not the best way, but definitely simple.

FB.provide is not a function

I'm developing a WordPress plugin to show above or bottom the posts Facebook like and send buttons.
Unfortunately when is also activated a plugin for Facebook share button there is a Javascript error (FB.provide is not a function) and like and send buttons don't appear.
For example this happens in this page: http://www.pasqualepuzio.it/2011/04/plugin-facebook-like-and-send-button/
How can I solve this issue?
Thank you very much
I ´ve faced the same problem and it happens if you add the script twice on the site (http://connect.facebook.net/sv_SE/all.js)
I understood that part that we cant have all.js twice but I want to have Facebook Share Button and Facebook Like Button.
According to Docs, I need to include these two JS Files.
https://connect.facebook.net/en_US/all.js
http://static.ak.fbcdn.net/connect.php/js/FB.Share
Now, If I include both Firebug will give me same error "FB.provide is not a function". If I remove either of them then Like or Share button wont work.
I can do iFrame version but I have HTML Encoding issues with iFrame Version. I am programmatic generating HTML Response.
Any idea, how to approach?
There is a workaround for this: instead of placing the javascript Fb.Share within the same page where you are loading the Javascript SDK, use an Iframe with the first and set it in the second.