Find existing message.google page - selenium-chromedriver

[selenium-chromedriver]
I have paired my phone with my PC using Google Messages. I now want to use selenium chromedriver to send message. But when I open the messages.google page it doesn't recognise the connection and takes me to the Pairing screen (displays a QR code to pair with the phone) not to the existing paired screen - ready to send messages.
There must be some setting to configure - but I don't know what it is or how to set it
Dim objChrome As New ChromeDriver
Dim wOptions As Object
objChrome.SetProfile "C:\Users\Geoff\AppData\Local\Google\Chrome\User Data\Default"
objChrome.start "chrome", "https://messages.google.com/web/conversations/2"
objChrome.Get "/"
If I manually type this URL in a browser it knows it is "me" and my phone is paired. But executing the code doesn't know that and thinks it is an unpaired situation

Related

How to start browser in WebDriver with custom localStorage set

I want to speed up my Selenium tests and noticed that a lot of time is being spent on login procedure.
Login on web application is implemented via localStorage session token (probably OAuth 2.0). I know how to set it once a browser starts and login page loads:
localStorage.setItem(key, value)
It works great. But is it possible to make the browser to pick up custom localStorage using Selenium (Java).
Is it profile?
Well this works for me in python
driver.excute_script('javascript:localStorage.(funtion of localStorage)')
so I suppose well you can set up a validation token like I use for test, and of course I get my auth_token from the database first, but it works like this
driver.excuteScript('javascript:localStorage.token="your validation token";');
should work

Setting profile/capabilities for chrome and ie8 through selenium

I am automating a test on aws.amazon.com to check whether the resources that i created using aws cli were successfully created or not using selenium webdriver. As the site falls out of my company network, to access the site i need to provide domain user/password in modal pop up that comes before hitting the url for the site.
i am not sure , but solution to this problem is to set profile/capability in the browser settings through the code. before hitting the url.
i have achieved that in firefox as follows
FirefoxProfile profile = new FirefoxProfile();
profile.addExtension(new File(Constants.FIREFOX_ADDON_PATH));
profile.setPreference("extensions.enabledAddons", "FireXPath%40pierre.tholence.com:0.9.7.1,proxyauth%40lammersoft.com:0.1.2,%7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D:37.0.1");
profile.setPreference("extensions.proxyauth.authtoken","c3ViaGFtdDpub3YwNDIwMTQ=");
How to do the same in chrome and ie8 ?
i went through this but not able to comprehend anything.Also what does .xpi and .crx file has to do with all of this ?
This is pop up image for chrome
This is pop up image for IE8
The popup is a Windows Http Authentication popup and cannot be handled by using Selenium Webdriver. You will have to use either Robot Class or AutoIT to handle it.
1. Using Robot Class:
Alert authenticationWindow = driver.switchTo().alert();
// Type the username/email.
authenticationWindow.sendKeys("<username/email address>");
// Shift cursor focus to password input text field.
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_TAB);
// Type the password in password field. [ Selenium does not know at this point that the cursor focus is shifted, so calling Alert class instance sendKeys() will cause password to be typed in username field. So, we are copying the password first to windows clipboard and then pasting it directly into the password field using Robot class instance ]
StringSelection stringSelection = new StringSelection("<user password>");
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection,null); robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
// Accept the authentication window.
robot.keyPress(KeyEvent.VK_ENTER);
2. Using AutoIT:
This link provides good information on how to use AutoIT alongwith Selenium: http://www.toolsqa.com/selenium-webdriver/autoit-selenium-webdriver/
Here is what you have to do:
Download/install AutoIT
You will be able to create .au3 scripts using AutoIT SciTe Editor
Compiling the .au3 script will give you a .exe file
Then you can invoke the .exe file from your Selenium script using
Runtime.getRuntime().exec("D:\AutoIt\AutoItTest.exe");
You can get the properties of a window using the AutoIT Window Info (x86) or (x64). Example, title / status bar of a window.
AutoIT also has Au3 Recorder so that you can record your actions that are related to the remote desktop.
Below is a sample script that automates Http authentication:
WinWaitActive("Web page title","","10")
If WinExists("Web page title") Then
Send("userid{TAB}")
Send("password{Enter}")
EndIf
3. Using AutoITx4Java:
Check this library AutoITx4Java - https://code.google.com/p/autoitx4java/
Download Jacob, AutoIT (refer the above link)
Add jacob.jar and autoitx4java.jar to your library path.
Place the jacob-1.15-M4-x64.dll file in your library path.
Sample Code
File file = new File("lib", "jacob-1.15-M4-x64.dll"); //path to the jacob dll
System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
AutoItX x = new AutoItX();
String notepad = "Untitled - Notepad";
String testString = "this is a test.";
x.run("notepad.exe");
x.winActivate(notepad);
x.winWaitActive(notepad);
x.send(testString);
Assert.assertTrue(x.winExists(notepad, testString));
x.winClose(notepad, testString);
x.winWaitActive("Notepad");
x.send("{ALT}n");
Assert.assertFalse(x.winExists(notepad, testString));

Windows Phone 8 ShellTile TargetUri

One Quick Question:
I want to navigate to settings(cellular..) from an secondary livetitle.
The Problem is the targetUrl for the Shelltitle(selectedShortcutsMenuControl.TargetUrl) in my app looks like this: "cellular",
and thats not an valid Uri format.
Exception : "An exception of type 'System.UriFormatException' occurred
in System.ni.dll but was not handled in user code"
StandardTileData data = new StandardTileData();
data.Title = selectedShortcutsMenuControl.Title;
data.BackgroundImage = myUri;
ShellTile.Create(new Uri(selectedShortcutsMenuControl.TargetUrl,UriKind.RelativeOrAbsolute), data);
Is there a way to fix this or is there a way, to directly navigate to cellular Settings form the livetitle?
<ctl:MenuData x:Key="ShortcutsMenuControlData">
<ctl:MenuItemData Title="Cellular" TargetUrl="wifi" Image="/Images/Item-fc0d2405-5b0f-4f3d-ba3e-5b93fbfe2c44.png"/>
<ctl:MenuItemData Title="WiFi" TargetUrl="cellular" Image="/Images/Item-c9f6c2c7-44e1-4079-ad90-e31b8a59333e.png"/>
<ctl:MenuItemData Title="Airplain Mode" TargetUrl="plaine" Image="/Images/Item-10845593-26f7-485a-bef7-cf9b9b0cf9fe.png"/>
<ctl:MenuItemData Title="Bluetooth" TargetUrl="bluetooth" Image="/Images/Item-294e2b67-5534-43b3-ae4e-aecf180c9274.png"/>
</ctl:MenuData>
So inorder to navigate to the native phone settings you need to use the built in URI schemes.
They can be found on MSDN here
Specifically for the ones you are asking for the codes are
ms-settings-airplanemode: Launches the Airplane Mode Settings app.
ms-settings-cellular: Launches the Cellular Settings app.
ms-settings-bluetooth: Launches the Bluetooth Settings app.
ms-settings-wifi: Launches the Wi-Fi Settings app.
replace your target url's with these and it should work

How to get appWindow from Chrome.app.window.create

I am trying to write a chrome.app that is able to open and close chrome.app windows on both displays of a system that is configured with two monitors. When launched, the chrome application establishes a socket connection with a native application running on the same computer, I also open a hidden window via chrome.app.window.create to keep the chrome application up and running. The native application then reads a configuration file and then sends a series of ‘openBrowser’ commands to the chrome application via the socket.
When the chrome application receives an ‘openBrowser’ command, the chrome application makes a call to the chrome API method chrome.app.window.create, passing the create parameters AND a callback function. A code snippet is below:
NPMBrowserManager.prototype.openBrowser = function (browserId,htmlFile,browserBounds,hidden,grabFocus)
{
var browserManager = this;
var createParameters = {};
createParameters.bounds = browserBounds;
createParameters.hidden = hidden;
chrome.app.window.create(htmlFile,createParameters,function(appWindow)
{
// Check to see if I got a non-undefined appWindow.
if(appWindow !== null)
{
browserManager.browsers.push({"browserId":browserId,"window":appWindow});
console.info("NPMBrowserManager.openBrowser: Added browser, id =" + browserId + ", count =" + browserManager.browsers.length);
}
});
}
Unfortunately, the ‘appWindow’, parameter passed in the create callback is always undefined. I suspect it has something to do with the fact that the method openBrowser is itself being called by another method that processes commands received from the native application. However, the window opens exactly here and when I want to to, I just can’t seem to cache away any information about the new window that can be used later to close or move the window.
I want to be able to cache away the appWindow so that I can close or modify the created window later on in the workflow.
As a side note, I’ve noticed that appWindow is NOT undefined if I call the openBrowser method from within the callback that is associated with the chrome.app.runtime.onLaunched event. I suspect it has something to do with the current script context. I was not able to find any chrome.app documentation that goes into any detail about the chrome app architecture.
I would GREATLY appreciate it if anyone out there can explain to me how I can get the appWindow of the window that is created in the chrome.app.window.create method. By the way, I have also tried calling chrome.app.window.current to no avail… Very frustrating!!!
I’d also be interested in any documentation that might exist. I am aware of developer.chrome.com, but could not find much documentation other than reference documentation.
Thanks for the help!
Jim

FaceboookDesktop user stays logged in after I call FaceboookDesktop.logout

Having the same issue as this user
As3 Graph API Logout
and this user
Facebook Kiosk Logout
Using the AS3 FacebookDesktop SDK for an AIR desktop based kiosk application
http://facebook-actionscript-api.googlecode.com/svn/release/current/docs/com/facebook/graph/FacebookDesktop.html
I can login, upload successfully.
Additionally when I call
FacebookDesktop.logout(handleLogout, APP_ORIGIN)
the response object returned in handleLogout = success
I have also defined APP_ORIGIN to = the same url associated with my APP_ID.
and set FacebookDesktop.manageSession = false
The problem is the user stays logged in after I upload and I need to log them out automatically after each upload.
This solution suggests targeting logout.php passing the ACCESS TOKEN.
https://stackoverflow.com/questions/7771821/log-out-from-facebook
But I don't have an access token, only a user ID.
Can anyone suggest a solution that works with an AIR desktop application?
see this thread
https://code.google.com/p/facebook-actionscript-api/issues/detail?id=206
'I had this problem and i solved using this workaround, you have to
download the source code of the 1.7 dist. Then open the
FacebookDesktop.as file and look for the logout function (not the
static one), then find the value 'params.next =
"http://static.ak.fbcdn.net/connect/xd_proxy.php#origin="+(appOrigin?appOrigin:"")'
and change it to 'params.next = "http://www.facebook.com/"'.