How to handle modal/ pop-up using automation - selenium

Tried to handle the pop-up many ways, need clarity do we need to change the body. because when the pop-up is displayed the new class is adding it is as below.
https://i.stack.imgur.com/jQC2B.png
The actual Pop-up class is as below. there is no close button for this pop-up.
https://i.stack.imgur.com/e1ZWc.png
-By manual user can close the pop-up when user click any where in the page. When i tried click any where using automation it is displaying as element not found
Here is the code i user to handle the pop-up i am so confused how to handle the pop-up
https://i.stack.imgur.com/ibf0j.png
Thanks for help in advance

please try to check the javascript from where this pop-up is executing and try to disable display property by setting it to none
Try to remove this div class name "_355Q0" from DOM. by using this javascript query.
var myobj = document.querySelector("._355Q0")
myobj.remove();

Related

How to add a onclick pop up form on a page?

When someone clicks on a button then a pop up form will appear.
I am trying to do but don't know how to fix it.
You can open new popup window form by javascript as you have to
call following with onclick event of your button
window.open(url, 'new tab', 'width=700,height=500');
You can also close this popup window after success of form submission by following
window.close(url);
In url you have to add your url.
If this is not work please share more information. thank you

Can't click button using InternetExplorer.Application

I'm trying to click the "Continue" button programatically using the InternetExplorer.application object on the page "http://www.dallascounty.org/criminalBackgroundSearch/". When I click the button, nothing happens.
Below is my code:
loie = CREATEOBJECT('internetExplorer.application')
loie.Navigate2('http://www.dallascounty.org/criminalBackgroundSearch/')
loie.Visible = .T.
loSubmitButton = loie.Document.getElementsByName('Submit')
loSubmitButton.item[0].Click()
Until about a week ago, the button was clicking with no problem. I realize there is also a capatcha on this page, but even if a manually click the "I am not a robot" box, I still can now programmatically click the "Continue" button on the page. Could somebody please tell me what this site did to their page that is preventing me from programmatically clicking buttons and how to get around it?
I also would like to get passed that captcha programmatically, but that is a separate problem which I will deal with later. However, if anybody has any tips on how to get passed that captha as well, I would be greatful.
Thank you

Cannot click Submit button on Selenium IDE

I am having trouble getting Selenium IDE to click the Submit button on one of my webforms after having selenium open and fill out the form. I am using the clickAndWait command and identifying the button by its ID:
<td>clickAndWait</td>
<td>id=ctl00_ContentPlaceHolder1_OSVFHResults_btSave</td>
<td></td>
Interestingly, if I write a script that simply opens the form and clicks the submit button without filling it out, I am not having any problems. My problem is coming specifically after I've asked Selenium to fill out the form. Additionally, if I try to manually click the submit button, it doesn't work if the Selenium script to fill out the form was run before my manual input. If I manually open and fill out the form, I have no problems clicking submit, and Selenium works for all of the other form's submit buttons on the site. Anyone have any ideas?
Instead of filling form with type command you can try typeKeys one. It simulates keystroke events on the specified element, as though you typed the value key-by-key and probably enable your submit button.
It sounds like some javascript event unrelated to click() (such as mouseover or onkeydown) is attached to one or more of the form fields and is responsible for enabling the submit button.
You'd have to look at which exact events are being fired, either by looking at the source with something like firebug, or by using a javascript debugger. Then modify your Selenium script to make sure the same events get triggered.
After type the values in the form just try "ClickAtandWait" instead of "clickandWait"..i also face the problem once and it gave hands once..
selenium.clickAtandWait("locator", "position");
if you know the exact "position" just put it, otherwise leave it as an empty string.

VB.NET Button clicks stuff in webbrowser1

How can i make it where you click button 1 and on a page like www.youtube.com/shanedawsontv in webbrowser1 it will click the text Add as friend cause they don't have ids for that please help
You'll likely have to use the WebBrowser Control's DocumentText Property to get the HTML of the page so that you can parse the required HTTP request required to add the user as a friend. That's likely to be no easy task with YouTube as it will probably be using hidden fields and Javascript (from a separate .js file) to make the request.

Unable to handle confrimation box with selenium RC

i am trying to press the ok button from a confirmation box like this (i added Thread.spleep so i checked the button is pressed and the confirmation box is shown)
selenium.chooseOkOnNextConfirmation();
selenium.click("xpath=//a[contains(#href,'123')]");
assertTrue(selenium.getConfirmation().equalsIgnoreCase("123"));
but i get this
com.thoughtworks.selenium.SeleniumException: ERROR: There were no confirmations
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
at com.thoughtworks.selenium.DefaultSelenium.getConfirmation(DefaultSelenium.java:429)
Thx for your help.
I got the same error with the code
selenium.chooseCancelOnNextConfirmation();//点击cancel按钮
selenium.click("link=Delete");
selenium.getConfirmation();
Finally I find the reason is that the developer used the jconfirm function of jquery instead of window.confirm, and the jconfirm function is override with div.
Finally I used assertTrue(selenium.isElementPresent("id=popup_container")).
from this information it is hard to say exactly. but i will give you some info which will help you
java script generates 3 types of pop-up windows
1) Alerts
2)Confirmations
3)Prompts
your case, i guess
1) may be the statement selenium.click() you used, is not triggering the confirmation box
OR
2) if it is triggering, then it may not be the Confirmation box.it could be any one of the other 2 boxes
so, you must make sure manually what type of pop-up window it is and call the statements accordingly.
ex : Confirmation window : conatins OK and Cancel buttons
Alert window : contains only OK button
Prompt window : contains Textbox and OK and Cancel buttons
so check and use that commands respectively
if it is not the above case please the HTML code also