Unable to Launch any browser using selenium webdriver - eclipse

I am trying to use eclipse to run Selenium web-driver automation but unable to open a browser window. Debug logs are showing that there is no error and I am successfully able to retrieve title of the web page as shown below:
try {
System.setProperty("webdriver.gecko.driver","/Users/shankar.sharma/Downloads/chrome-driver/geckodriver");
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
FirefoxOptions options = new FirefoxOptions();
options.addPreference("log", "{level: error}");
WebDriver driver = new FirefoxDriver();
driver.navigate().to("http://www.seleniumhq.org/download/");
String appTitle = driver.getTitle();
System.out.println("Application title is :: "+appTitle);
driver.quit();
} catch (Exception e) {
System.out.println("Exception:"+e.getMessage());
}
Debug Logs:
1496221115902 geckodriver INFO Listening on 127.0.0.1:39119
1496221116097 geckodriver::marionette INFO Starting browser /Applications/Firefox.app/Contents/MacOS/firefox-bin with args ["-marionette"]
1496221117678 Marionette INFO Listening on port 63210
May 31, 2017 2:28:38 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
2017-05-31 14:28:38.036 plugin-container[55325:3295542] * CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x9c3b, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2017-05-31 14:28:38.038 plugin-container[55325:3295542] * CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x9f03, name = 'com.apple.CFPasteboardClient'
See /usr/include/servers/bootstrap_defs.h for the error codes.
Application title is :: Downloads
1496221129876 Marionette INFO New connections will no longer be accepted
But browser window is not opening. I have also tried with chrome driver but that is also not working. I am using below configurations :
Selenium Web-driver : 3.4.0
LGecko driver : v0.16.0
Any ideas about the cause why this is happening?

I have checked the same in my mac but its working fine for me.. Below is the default code for which i can see the browser has been getting launched automatically...
public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver", "/Users/santhoshkumar/Documents/Softwares/chromedriver");
driver.manage().windows().maximize();
WebDriver driver = new ChromeDriver();
driver.get("http://facebook.com");
System.out.println(driver.getTitle());
}
Since this is not working for you.. Try to use chromeoptions..
public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver", "/Users/santhoshkumar/Documents/Softwares/chromedriver");
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
options.addArguments("--start-fullscreen");
WebDriver driver = new ChromeDriver(options);
driver.get("http://facebook.com");
System.out.println(driver.getTitle());
}
Hope this helps you. Thanks.

Go through my answer on this link and make sure that your browser firefox version is below 48.0
Enjoy :)

Related

Asterisk-Java Unable to load Properties file

I'm developing a very simple Asterisk-Java IVR based program that greets the caller, retrieves some information from a web service, reads up the retrieved data to the caller, and finally hangs up.
What steps I followed:
Added the following line is entered on extensions_custom.conf:
exten => 1000,n,Agi(agi://192.168.0.8/ivryobi.agi)
Created the following file structure inside C:\Project\target\classes\
Runnable.java
IvrYobi.java
Runnable.class
IvrYobi.class
fastagi-mapping.properties
Inside fastagi-mapping.properties I have:
ivryobi.agi = main.IvrYobi
The contens of IvrYoby are:
public class IvrYobi extends BaseAgiScript {
public void service(AgiRequest request, AgiChannel channel) throws AgiException {
String callerMsisdn = request.getCallerIdNumber();
}
When it works normally
Running the following command in the console
C:\Project\target\classes>java -cp
asterisk-java.jar;commons-lang3-3.10.jar;commons-logging-1.2.jar;httpclient-4.5.12.jar;httpcore-4.4.13.jar;mysql-connector-java-8.0.20.jar;.
org.asteriskjava.fastagi.DefaultAgiServer
As you can see on the following console output, works perfectly
jun 30, 2020 6:09:04 PM org.asteriskjava.fastagi.DefaultAgiServer
startup INFORMACIËN: Listening on *:4573. jun 30, 2020 6:09:09 PM
org.asteriskjava.fastagi.AbstractAgiServer getPool INFORMACIËN: Thread
pool started. jun 30, 2020 6:09:09 PM
org.asteriskjava.fastagi.ResourceBundleMappingStrategy
loadResourceBundle INFORMACIËN: Added mapping for 'ivryobi.agi' to
class IvrYobi ...
When the problem appears
When I run the very same code, but insted of the console I use Runnable.java
Here are the contents of Runnable.java:
DefaultAgiServer server = new DefaultAgiServer();
public MyRunnable() {
ClassNameMappingStrategy strategy = new ClassNameMappingStrategy(false);
server.setMappingStrategy(strategy);
}
public void run() {
try {
server.startup();
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
server.shutdown();
}
}
public void stop() {
server.shutdown();
}
We can observe the following error on Eclipse's console:
0 [main] DEBUG org.asteriskjava.fastagi.DefaultAgiServer - Using
channelFactory
org.asteriskjava.fastagi.internal.DefaultAgiChannelFactory 9 [main]
INFO org.asteriskjava.fastagi.DefaultAgiServer - Listening on *:4573.
4806 [main] DEBUG org.asteriskjava.fastagi.DefaultAgiServer -
Received connection from /192.168.0.254 4810 [main] INFO
org.asteriskjava.fastagi.DefaultAgiServer - Thread pool started. 4849
[AJ DaemonPool-1.1] DEBUG
org.asteriskjava.fastagi.ClassNameMappingStrategy - Unable to create
AgiScript instance of type ivryobi.agi: Class not found, make sure the
class exists and is available on the CLASSPATH 4849 [AJ
DaemonPool-1.1] ERROR
org.asteriskjava.fastagi.internal.FastAgiConnectionHandler - No
script configured for URL 'agi://192.168.0.8/ivryobi.agi' (script
'ivryobi.agi')
Attempted troubleshooting
I already made sure that fastagi-mapping.properties is on the CLASSPATH.
Tried different name and case
Copied the .properties file on the java Execution Path
Compiled the project as an executable jar
Added / removed packages inside eclipse (ex: com.test.IvrYobi) and also applied the changes on the .properties file.
I checked the code inside asterisk-java-3.5.0.jar, looks like that in case that the configuration file is not found, it just continues without throwing any warning. Since is packed inside the jar I'm unable to modify that code.
Please, do you have any other ideas I can try?
Finally found the solution by myself
I had to recompile asterisk-java.jar using the project's source code
On DefaultAgiServer.java change the line:
resourceBundle = ResourceBundle.getBundle(configResourceBundleName);
With:
FileInputStream fis = new FileInputStream("myivr.properties");
resourceBundle = new PropertyResourceBundle(fis);
logger.info("resourceBundle cargado ok!");
On the catch, replace the
return;
with a more decent response, so you will know if the resource could not be loaded
logger.info("resourceBundle cargado ok!");
}
catch (MissingResourceException | IOException e)
{
logger.error("No existe el recurso invocado: " + e.getMessage());
return;
}

Selenium WebDriver, when loading an HTTPS website, closes and reopens browser and does not even attempt to interact with the DOM

Selenium WebDriver (run from Eclipse Oxygen.3a Release (4.7.3a)) seems to be unable to handle any HTTPS website.
By that I mean this: upon loading the page (regardless of whether it redirects or not, tried with gitlab and AWS logon sites)
Logon page loads properly (no SSL certificate issues, any redirect happens just fine), yet Selenium doesn't do anything (debug mode shows it's not even trying to execute the logon code)
It times out (browserWaitTimeout=15) and closes/reopens the logon page
This happens until the 4th time, upon which Selenium finally reaches my logon code (a breakpoint I set there is finally hit), but this happens between browser page closing and reopening, thus it never detects the DOM and fails.
And the most frustrating thing is, console shows NO ERRORS.
Here: Chrome:
Jul 03, 2019 8:40:44 AM com.fincad.vcr.qa.support.WebDriverFactory createWebDriver
INFO: Web driver is created successfully
Jul 03, 2019 8:40:55 AM com.fincad.vcr.qa.support.WebDriverFactory quitWebDriver
INFO: Web driver quits successfully
That's it, as in literally it (notice the 15 second gap? That's browserWaitTimeout).
a) I tried FF, where I saw errors from Marionette:
1562172157538 Marionette INFO Listening on port 56792
1562172157572 addons.xpi-utils DEBUG Successfully read XPI database
1562172157603 addons.manager DEBUG Registering upgrade listener for
formautofill#mozilla.org
Jul 03, 2019 9:42:37 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Jul 03, 2019 9:42:38 AM com.fincad.vcr.qa.support.WebDriverFactory createWebDriver
INFO: Web driver is created successfully
1562172170219 Marionette INFO Stopped listening on port 56792
1562172170243 addons.xpi DEBUG Calling bootstrap method shutdown on webcompat#mozilla.org version 4.0.0
1562172170249 addons.xpi DEBUG Calling bootstrap method shutdown on screenshots#mozilla.org version 37.1.0
1562172170253 addons.xpi DEBUG Calling bootstrap method shutdown on fxmonitor#mozilla.org version 3.0
1562172170254 addons.xpi DEBUG Calling bootstrap method shutdown on formautofill#mozilla.org version 1.0
[Parent 12824, Gecko_IOThread] WARNING: pipe error: 109: file z:/task_1560988628/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 21788, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1560988628/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 21788, Chrome_Chi[Parent 12824, Gecko_IOThread] WARNING: pipe error: 109: file z:/task_1560988628/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 6644, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1560988628/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 6644, Chrome_ChildThread] WAR[Parent 12824, Gecko_IOThread] WARNING: pipe error: 109: file z:/task_1560988628/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 17844, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1560988628/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 17844, Chrome_ChildThread] WARNING: pipe er[Parent 12824, Gecko_IOThread] WARNING: pipe error: 109: file z:/task_1560988628/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Chi###!!! [Parent][MessageChannel] Error: (msgtype=0x1F0099,name=PBrowser::Msg_UpdateNativeWindowHandle) Closed channel: cannot send/recv
I googled and people mentioned it's due to outdated FF driver, so I upgraded, but it didn't do any good (same errors appear). And in IE it's like Chrome: no error or warning msg at all.
My drivers are these:
Selenium WebDriver: 3.14.0 (32-bit)
geckodriver 0.24.0 (32-bit)
chromedriver 74.0.3729.6 (32-bit)
IEDriverServer 3.8.0 (32-bit)
And my browsers:
Chrome browser: 75.0.3770.100
FF browser: 67.0.4
IE browser: 11.557.17763
This is how I create my drivers:
private static void createFirefoxDriver() {
setCapability("firefox");
GeckoDriverService.Builder builder = new GeckoDriverService.Builder();
GeckoDriverService service = builder.build();
FirefoxOptions options = new FirefoxOptions(capabilities);
// Read the default firefox profile
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myProfile = profile.getProfile("default");
// Disable the web page from asking if really want to leave
myProfile.setPreference("dom.disable_beforeunload", true);
options.setProfile(myProfile);
driver = new FirefoxDriver(service, options);
}
private static void createChromeDriver() {
setCapability("chrome");
ChromeDriverService.Builder builder = new ChromeDriverService.Builder();
ChromeDriverService service = builder.build();
ChromeOptions options = new ChromeOptions();
options.merge(capabilities);
driver = new ChromeDriver(service, options);
}
This is how I load the URL (local webdriver):
private static void createLocalWebDriver() {
String browser = ConfigParser.getBrowser();
LOGGER.info("Target Browser: " + browser);
switch (browser) {
case "firefox":
System.setProperty("webdriver.gecko.driver", ConfigParser.getGeckoDriver());
System.out.println("GeckoDriver on: " + ConfigParser.getGeckoDriver());
createFirefoxDriver();
break;
case "chrome":
System.setProperty("webdriver.chrome.driver", ConfigParser.getChromeDriver());
System.out.println("ChromeDriver on: " + ConfigParser.getChromeDriver());
createChromeDriver();
break;
case "ie":
System.setProperty("webdriver.ie.driver", ConfigParser.getIEDriverServer());
System.out.println("IEDriver on: " + ConfigParser.getIEDriverServer());
createIEDriver();
break;
default:
LOGGER.warning("Unsupported Browser: " + browser);
break;
}
}
private static void createFirefoxDriver() {`enter code here`
setCapability("firefox");
GeckoDriverService.Builder builder = new GeckoDriverService.Builder();
GeckoDriverService service = builder.build();
FirefoxOptions options = new FirefoxOptions(capabilities);
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myProfile = profile.getProfile("default");
myProfile.setPreference("dom.disable_beforeunload", true);
options.setProfile(myProfile);
driver = new FirefoxDriver(service, options);
}
private static void createChromeDriver() {
setCapability("chrome");
ChromeDriverService.Builder builder = new ChromeDriverService.Builder();
ChromeDriverService service = builder.build();
ChromeOptions options = new ChromeOptions();
options.merge(capabilities);
driver = new ChromeDriver(service, options);
}
private static void createIEDriver() {
setCapability("ie");
InternetExplorerDriverService.Builder builder = new InternetExplorerDriverService.Builder();
InternetExplorerDriverService service = builder.build();
InternetExplorerOptions options = new InternetExplorerOptions(capabilities);
driver = new InternetExplorerDriver(service, options);
CommonJS.executeScript(driver, "window.localStorage.clear();");
CommonJS.executeScript(driver, "window.sessionStorage.clear();");
}
private static void setCapability(String browser) {
capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
capabilities.setCapability(CapabilityType.ELEMENT_SCROLL_BEHAVIOR, true);
if (browser.equalsIgnoreCase("ie")) {
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
capabilities.setCapability(InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true);
capabilities.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, ConfigParser.getAppUrl());
} else if (browser.equalsIgnoreCase("chrome")) {
ChromeOptions options = new ChromeOptions();
options.addArguments("chrome.switches","--disable-extensions");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
}
}
Sorry for all the code, but I'm sure I'll be asked about those details, hence my putting there.
Long story short:
This only happens with HTTPS URL's
Non HTTPS URL's work just fine
It's not an SSL certificate issue otherwise I would have seen it on the screen "This connection is untrusted".
It was a problem at page load code. Found a section that was explicitly expecting HTTP only, thus refusing to load any HTTPS URL.

Hi im getting below error when im trying to run selenium through eclipse for my local URL test

Getting below error when tried to execute selenium firefox driver for my local URL:
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
ession ID: 107f76f0-251f-4d62-9308-2968ed6e354f
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)
at Gmail_login.main(Gmail_login.java:14)
Code
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
public class Gmail_login {
public static void main(String[] args) {
// TODO Auto-generated method stub
// objects and variables instantiation
System.setProperty("webdriver.gecko.driver", "C:\\Selenium\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
String appUrl = "https://localhost/qwer";
// launch the firefox browser and open the application url
driver.get(appUrl);
//maximize the browser window
driver.manage().window().maximize();
//declare and initialize the variable to store the expected title of the webpage.
String expectedTitle = "Web Login Service";
//fetch the title of the web page and save it into a string variable
String actualTitle = driver.getTitle();
//compare the expected title of the page with the actual title of the page and print the result
if (expectedTitle.equals(actualTitle))
{
System.out.println("Verification Successful - The correct title is displayed on the web page.");
}
else
{
System.out.println("Verification Failed - An incorrect title is displayed on the web page.");
}
// enter a valid username in the email textbox
WebElement username = driver.findElement(By.id("username"));
username.clear();
username.sendKeys("karthiktest#gmail.com");
// enter a valid password in the password textbox
WebElement password = driver.findElement(By.id("password"));
password.clear();
password.sendKeys("Welcome");
// click on the Sign in button
WebElement SignInButton = driver.findElement(By.name("_eventId_proceed"));
SignInButton.click();
// close the web browser
driver.close();
System.out.println("Test script executed successfully.");
// terminate the program
System.exit(0);
}
}
Firefox driver throws this error if url is not accessible, for example domain name can't be resolved or server blocks connection. It will work if you install webserver on your localhost and serve some content for this url.
You can try to switch firefox to chrome which doesn't throw exception for this scenario. You can also write try-catch block around your driver.get() statement.
This is an INFO message and just so people can see what is going on.
Its not an error and something to worry about.
this message occurs when using version above selenium3.0.0 and geckodriver
this will not stop the script execution.

Protractor/Typescript : uncaught InvalidElementStateError

I am writing my first protractor test in Typescript..Here is PageObjectModel class
HomePagePOM.ts
export module HomePage{
export class HomePagePom {
helloTextInput = element(by.model("yourName"));
helloTextDisplay = element(by.css("ng-binding"));
launchPage(url: string): void {
browser.get(url);
console.log("success");
browser.waitForAngular();
}
typeHello(text: string): void {
this.helloTextInput.getWebElement().click();
this.helloTextInput.getWebElement().sendKeys(text);
}
getHelloText() : string {
return this.helloTextDisplay.getWebElement().valueOf();
}
}
}
and my spec class HomePageSpec.ts
import id = require("chai");
import hpp = require("./HomePagePOM");
import HomePage = hpp.HomePage;
var expect = id.expect;
var assert = id.assert;
var should = id.should;
describe("Launch the home page", () => {
var homePagePom = new HomePage.HomePagePom();
it("Launch should be successful", () => {
homePagePom.launchPage("https://www.angularjs.org");
assert.equal("test", "test", "test is success");
});
it("Type Hello Text successfully", () => {
homePagePom.typeHello("Arun");
//assert.equal("test", "test", "test is success");
});
it("Type Hello Text successfully", () => {
assert.equal(homePagePom.getHelloText(), "Hello Arun!", " Hello text typed and retrieved successfully");
});
});
when I run the test, I get this error as below
C:\VisualStudio2013\SampleAutomationPOC\SampleAutomationPOC>protractor conf.js
[23:02:59] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[23:02:59] I/launcher - Running 1 instances of WebDriver
[mochawesome] Generating report files...
Launch the home page
success
1) Launch should be successful
2) Type Hello Text successfully
3) Type Hello Text successfully
0 passing (4s)
3 failing
1) Launch the home page Launch should be successful:
Uncaught InvalidElementStateError: invalid element state: Failed to execute 'replace' on 'Location': '' is not a valid URL.
(Session info: chrome=51.0.2704.103)
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any
stacktrace information)
Command duration or timeout: 6 milliseconds
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'ION3076W7LT-3', ip: '10.210.94.178', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_40'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1
cdabed0983e7c4), userDataDir=C:\Users\ion3076\AppData\Local\Temp\scoped_dir10008_16863}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasT
ouchScreen=false, version=51.0.2704.103, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webSt
orageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 70409fcf7ae2dfd5a1058292d0c30684
I have 2 problem
1. obviously the error
2. when the script executes the angularjs.org website doesn't load all the components completely. Meaning some of the components are blank and the loading looks completed. (the object i am interacting is not shown on the page). So while the script is running i tried to hit the refresh button quickly twice and then the page loaded completely. Manually launching everything looks fine.. Not sure what is causing the issue.
The object I am interacting is unique as far as i know..
Any clues to help me out? enter code here
thanks in advance.
Never mind ..I figured out the answer. For prep reasons i thought of launching the blank browser, I added a line of code browser.get('') in the conf.js under onPrepare() function section. That is causing the issue as ' ' invalid url. I removed it and now it goes through smooth.. long day...and missed to catch the obvious.
Thanks.

How to process credit card in hosted mode via QBMS Java API

I modified the sample provided here, but it doesn't work for the hosted app.
Clearly the problem is the connection ticket, which should not be used from my understanding.
The following is the java class:
public class MyPayment {
public static void main(String[] args) throws Exception{
QbmsConfiguration qbmsConfiguration =new QbmsConfiguration("/qbmsconnector.properties");
// Create a JAXB-backed QbmsConnector
QbmsConnector qbmsConnector =new JaxbQbmsConnector(qbmsConfiguration);
// Build a charge request...
CreditCardChargeRequest request =new CreditCardChargeRequest();
request.setCreditCardNumber("4111111111111111");
request.setNameOnCard("John Doe");
request.setExpirationMonth(12);
request.setExpirationYear(2014);
request.setAmount(130.00);
// ...define a connection ticket...
String connectionTicket ="TGT-XXX-XXXXXXXXXXXXXXXXXXXXXX";
// ...and make the payment.
try{
CreditCardChargeResponse response = qbmsConnector.creditCardCharge(connectionTicket, request);
System.out.println(response);
}catch(QbmsOperationException e){
System.out.println("Payment failed: "+ e.getMessage());
e.printStackTrace();
}
}
}
Here is the qbmsconnector.properties
qbmsconnector.applicationLogin=loginidxxxxxx
qbmsconnector.applicationId=123456789
qbmsconnector.environment=ptc
qbmsconnector.model=hosted
qbmsconnector.keyStoreLocation=/qbms
qbmsconnector.keyStorePassword=password111
qbmsconnector.certPassword=password111
qbmsconnector.certAlias=alias_abc
It throws the following errors:
Payment failed: Application agent not found TGT-XXX-XXXXXXXXXXXXXXXXXXXXXX
com.intuit.qbmsconnector.response.QbmsResponseStatusException: Application agent not found TGT-XXX-XXXXXXXXXXXXXXXXXXXXXX
at com.intuit.qbmsconnector.jaxb.JaxbResponseExtractor.processSignonNode(Unknown Source)
at com.intuit.qbmsconnector.jaxb.JaxbResponseExtractor.unmarshal(Unknown Source)
at com.intuit.qbmsconnector.jaxb.JaxbResponseExtractor.extractCreditCardChargeResponse(Unknown Source)
at com.intuit.qbmsconnector.jaxb.JaxbQbmsConnector.creditCardCharge(Unknown Source)
at qbo.MyPayment.main(MyPayment.java:30)
This error:
Application agent not found TGT-XXX-XXXXXXXXXXXXXXXXXXXXXX
Generally indicates 1 or 2 things:
You're not using a valid connection ticket (is that the actual connection ticket you're using, or did you XXX out the connection ticket?)
OR
You're using a valid connection ticket, but you're using it with the wrong environment. Connection tickets generated in the PTC environment do not work with the production environment, and vice versa. Did you generate the connection ticket for PTC, or for production?