Handle Chrome default pop up through selenium web-driver - google-chrome

I am working on automation test-case through selenium web-driver. I am stuck at one place where I am always getting first chrome'd default pop up. I am not able to do anything with that pop up as it's not inspecting in code, Please check in attached screen shot for default pop-up.
Please suggest me to handle these thing. Any help is appreciated.

These are Window based pop up, which is not controlled by selenium so need to use java.awt.Robot class or Autoit tool.
Robot class describe as-
for example:
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_TAB);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_SPACE);
robot.keyRelease(KeyEvent.VK_SPACE);
robot.delay(10000);
it takes one key at a time, we can not pass multiple keys at one time.
Hope this will solve your problem.

Related

How to use Selenium web browser to post in salesforce

My friend recommended Kantu for work automation hence I'm trying it out but couldn't seem to find the answer to my question on the web.
I'm new at coding, automation, stackoverflow and this is my first post.
Have just installed Kantu for Chrome- Selenium IDE Light and am trying to automate a daily post message within salesforce.
However, have received this error when I try to click on the message box.
[error]
time out when looking for element '//*[#id="outerContainer"]/div[1]/div[1]/div[1]/p'
When I click on inspect, I find this code for the message box:
I've tried running the Test Case demos and everything seems to be able to run well without problems. Noticed that the key difference in the Selenium IDE demos are that the text boxes are fixed (i.e. constantly appearing on the pages) whilst the text boxes within salesforce only appear when clicked upon.
Have tried to add in macros to click on the text div box within salesforce but Selenium doesn't seem to be able to record the click part hence unable to insert any texts into the salesforce.
Hope someone can help.
Many thanks in advance, happy new year!

Catching back and home keys

After I set up my new project with libGDX v1.3.1 i am stuck with something that should be easy. In my main class which extends game I have:
Gdx.input.setCatchBackKey(true);
but I cannot get any response from this (in render method):
if(Gdx.input.isButtonPressed(Keys.BACK)){
this.dispose();
}
It like nothing was pressed, although I can see that the button was pressed in logCat console.
I need to mention that I was using the exact same code until libGDX version 1.0.0 (or the first one with gradle).
Note: i have also tried implementing InputProcessor and then setting the input processor. Result was the same.
And for the home button: using Gdx.input.setCatchMenuKey(true); is not working.
Use isKeyPressed instead of isButtonPressed. Buttons only refers to the three mouse buttons on a desktop game. Everything on Android is a Key (or Peripheral).
You mentioned "home button" but the code you posted is for the menu button. There is no way to catch the home button unless you make your manifest declare your app as a launcher replacement, in which case, the home button will always open your app, even when it's closed, and the user will have no easy way to get to the home screen. And libgdx doesn't have that functionality built in, since that would be weird. You would have to implement it yourself in your manifest and main Activity.
Also, disposing of this, whatever this is, sounds dangerous to do from the input handler. You could be about to render stuff and cause a crash. But I'm not sure where you're trying to use it from. Maybe it's OK.

Sikuli: Find Element by Id (or xpath)

I am using Sikuli and for first time I am stuck and need some "light".
I have a div which contains the user profile image, is impossible to visual recognise this with sikuli since the image is changing. Also I have no other element around that can help me get that element.
I need somehow to get that element by the id and I cannot find any info if such a method exist in Sikuli.
Why you are using sikuli to automate web in first place?
For that, selenium do the job better. Or if you like, a more high level framework: Robotframework/Cucumber/Lettuce with selenium library.
If you really want use sikuli you can try this:
Give it a picture on the side of avatar with a offset.
Example:
GUI: User Xpto [AVATAR] Logout
You can take a picture from logout and give offset to move it:
Example not tested: Click [USER] 50 #move right on the x coordinate
Example not tested: Click [LOGOUT] -10 #move left on the x coordinate
Sikuli is visual automation tool, works only with images or text found on images (SikuliX). So it does not accept xpath/id etc attributes of elements in a web-page. however if you want to use them please use Selenium Webdriver or Selenium extension with SikuliX.
You might want to explore Sikuli-WebDriver. SikuliFirefoxDriver extends Selenium's FirefoxDriver and you can search by id etc. Read more about Sikuli-WebDriver here.
For automating web pages, it is better to use selenium webdriver rather than sikuli.
In webdriver, we can find element by id.
sikuli purely works on visible image, it cannot find any element by its html attributes.

Selenium does not record Ajax Call. Need help on coding in html or selenese

I am recording a .Net application using Selenium IDE. Theres this scenario, that a textbox is presnt. I need to enter a name to search. As soon as i start typing, matching options come in a dropdown below. I have to select one of them, then the application goes to the next page.
The problem is, Selenium doesnt record this selection from the drop down. More over, when the script is typing in the name, the dropdown list is not being visible at all.. i.e. the ajax call is not occuring.
Please help. I need the solution code in Selenese or HTML, since I'm not much of a coder myself, and also, I am simply recording and playback, so I am not using Java or other scripts.
This question is great,
and so is the answer in this blog: http://blog.buberel.org/2010/07/howto-test-jquery-ajax-autocomplete-menus-with-selenium.html
other option to deal with this problem is to use a different way to insert your text into the text box, as described here: Can selenium handle autocomplete?

Creating Chrome popup with a C++ program

Problem context:
I have a C++ program and a web presence. Currently the way things are working I have made a control panel with javascript and html. And it send commands via an unimportant communication medium to control things or get information from the C++ program.
Now, when the C++ program launches, I'm making it run a
ShellExecute(NULL, "open", addressBuffer," --new-window", NULL, SW_NORMAL);
This is a way of launching the default browser with the given address. The addressBuffer in this case points to an intermediate HTML file that quickly turns around and uses the
window.open()
in Javascript to open the final popup, then closes itself.
The result is the user now has the popup control panel that I want them to have but the user's main browser window also gets given focus, un-minimized, and placed on a different tab than the one they had selected. (Basically pops up out of nowhere and selects a another tab)
Problem:
I'm looking for a way to launch a Chrome popup, without disturbing a previously open browser window. Any ideas or solutions would be very helpful.
Lastly, it's worth noting that the " --new-window" from the code above doesn't actually open a new window like you would expect. In this case it's actually doing nothing... If it did work, none of this would really be an issue.
I know this is wordy so thanks in advance for you time!
-Michael
Alright, I came up with a solution.
Something about how ShellExecute processes it's commands was preventing the command line args to be passed in correctly.
My work-around includes grabbing the path to Chrome from the registry,
HKET_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe
Then simply doing a system() command with the chrome path "--new-window" and the web path.
Then I let the intermediate html page open it's popup and close itself.
Tada done.
Thanks.