IE does not launch using RemoteWebDrivr TestNG - webdriver

Could someone please help me resolve this issue. When I run my following code in TestNG I get the following error: "The path to the driver executable must be set by the webdriver.ie.driver system property;"
public class GoogleSearch2 {
RemoteWebDriver driver;
DesiredCapabilities cap;
#Test(dataProvider="getData")
public void searchTest2() throws MalformedURLException{
System.out.println(browser);
if(browser.equals("firefox")){
System.setProperty("webdriver.firefox.bin", "C:\\Users\\sqadri \\Mozilla
Firefox\\firefox.exe");
cap = DesiredCapabilities.firefox();
cap.setBrowserName("firefox");
cap.setPlatform(Platform.ANY);
}
else if(browser.equals("iexplore")){
File file = new File("D:/Data/IEDriver/IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
cap = DesiredCapabilities.internetExplorer();
cap.setBrowserName("iexplore");
cap.setPlatform(Platform.WINDOWS);
}

If you are using selenium grid then start your node passing the path of the IE driver. This worked for me.
java -jar selenium-server-standalone-2.37.0.jar -role node -nodeConfig configNodes.json -Dwebdriver.ie.driver=<your path>/IEDriverServer.exe

Related

Corda - Failed to find a store at certificates\sslkeystore.jks

Corda open source on Linux. Node RPC SSL enabled. I am getting error "Failed to find a store at certificates\sslkeystore.jks". Any ideas? I have entered absolute path in keyStorePath.
You must follow the steps of this paragraph: https://docs.corda.net/clientrpc.html#wire-security which I detailed for you below.
When you enable RPC SSL, you must run this command one time (you will be asked to supply 2 new passwords):
java -jar corda.jar generate-rpc-ssl-settings
It will create the rpcsslkeystore.jks under certificates folder, and rpcssltruststore.jks under certificates/export folder.
Inside your node.conf supply the path and password of rpcsslkeystore.jks:
rpcSettings {
useSsl=true
ssl {
keyStorePath=${baseDirectory}/certificates/rpcsslkeystore.jks
keyStorePassword=password
}
standAloneBroker = false
address = "0.0.0.0:10003"
adminAddress = "0.0.0.0:10004"
}
Now if you have a webserver, inside NodeRPCConnection you must use the constructor that takes a ClientRpcSslOptions parameter:
// RPC SSL properties.
#Value("${config.rpc.ssl.truststorepath}")
private String trustStorePath;
#Value("${config.rpc.ssl.truststorepassword}")
private String trustStorePassword;
#PostConstruct
public void initialiseNodeRPCConnection() {
NetworkHostAndPort rpcAddress = new NetworkHostAndPort(host, rpcPort);
ClientRpcSslOptions clientRpcSslOptions = new ClientRpcSslOptions(Paths.get(trustStorePath),
trustStorePassword, "JKS");
CordaRPCClient rpcClient = new CordaRPCClient(rpcAddress, clientRpcSslOptions, null);
rpcConnection = rpcClient.start(username, password);
proxy = rpcConnection.getProxy();
}
We added above 2 extra attributes that you must now supply when starting the webserver, for that; modify your clients module build.gradle:
task runNodeServer(type: JavaExec, dependsOn: jar) {
classpath = sourceSets.main.runtimeClasspath
main = 'com.example.server.ServerKt'
args '--server.port=50005', '--config.rpc.host=localhost',
'--config.rpc.port=10005', '--config.rpc.username=user1', '--config.rpc.password=test',
'--config.rpc.ssl.truststorepath=/path-to-project/build/nodes/your-node/certificates/export/rpcssltruststore.jks',
'--config.rpc.ssl.truststorepassword=password'
}
If you're planning to connect to the node with a standalone shell, you must do something similar, but it didn't work for me; I reported the following bug: https://github.com/corda/corda/issues/5955

.NET Core Error 1053 the service did not respond to the start or control request in a timely fashion

I created a Windows Service starting from my .NET Core project following this
After this, I installed correctly it on my working machine and started it.
This is my service class:
using System;
using System.Diagnostics;
using System.ServiceProcess;
using System.Threading.Tasks;
namespace xxx
{
public class WindowsService
{
static void Main(string[] args)
{
System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory);
using (var service = new Service())
{
ServiceBase.Run(service);
}
}
}
internal class Service : ServiceBase
{
public Service()
{
ServiceName = "...";
}
protected override void OnStart(string[] args)
{
try
{
base.OnStart(args);
Task.Run(() => xxxx);
}
catch (Exception ex)
{
EventLog.WriteEntry("Application", ex.ToString(), EventLogEntryType.Error);
}
}
protected override void OnStop()
{
base.OnStop();
}
protected override void OnPause()
{
base.OnPause();
}
}
}
So, I copied the file and installed it also on a server. Here, when I try to start it, I get:
After this, I start a lot of googling... for example, I tried the following steps :
Go to Start > Run > and type regedit
Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
With the control folder selected, right click in the pane on the right and - select new DWORD Value
Name the new DWORD: ServicesPipeTimeout
Right-click ServicesPipeTimeout, and then click Modify
Click Decimal, type '180000', and then click OK
Restart the computer
The weird point here is that the voice ServicesPipeTimeout didn't exist and I created it. Comparing the server with my working machine, there are also other value not present in the server. They are:
ServicesPipeTimeout
OsBootstatPath
Here the screenshot of regedit from the server:
Are these relevant?
I also tried to reinstall the service, recompile my files... how can I fix this problem? The error appears immediatly, it doesn't wait any timeout!
I had this problem when I switched my project to another location.
When I moved the project, I had copied the files in bin/debug folder too. The issue was resolved after I cleared the debug folder and created a new build.
See if this works!
It's a bit old question but someone may find this useful.
So I had the following code in Program.cs:
builder.SetBasePath(Environment.CurrentDirectory).AddJsonFile("appsettings.json")
Changed it to:
builder.SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)).AddJsonFile("appsettings.json")
This seemed to fix the problem for me.
The problem with this error is that it is super generic.
Hopefully MS will give us some log in the future.
if you check the windows event viewer under applications it tells you what exactly is the exception that causes this error.
in my case the problem was i published the service in net6 and tried to run it on a pc with net7 installed. apparently it requires the exact major version that was used to publish the app.

use msdeploy to install a zip-package on a remote computer from commandline

I have a .zip package that I want to install on a development server from my development machine. So I use the msdeploy to do this automatic for me.
msdeploy.exe -verb:sync -source:package=Debug_Services_14.02.20.1413.zip -dest:auto,computername=DEVELOPMENTSERVER,username=ADMIN_USER,password=ADMIN_PWD
But it fails saying that the ERROR_SITE_DOESNT_EXIST.
Info: Adding sitemanifest (sitemanifest).
Info: Adding createApp (MY_SERVICE).
Info: Adding contentPath (MY_SERVICE).
Error Code: ERROR_SITE_DOES_NOT_EXIST
More Information: Site MY_SERVICE does not exist. Learn more at: http
://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SITE_DOES_NOT_EXIST.
Error count: 1.
But I am trying to install it for the first time! What have I missed?
For example. msdeploy api c#.
Execute MSDeploy from C# program code like an API
public static void AppSynchronization(DeploymentBaseOptions depBaseOptions, string appPath)
{
var deploymentObjectSyncApp = DeploymentManager.CreateObject(
DeploymentWellKnownProvider.Package,
appPath, new DeploymentBaseOptions());
deploymentObjectSyncApp.SyncTo(DeploymentWellKnownProvider.Auto, string.Empty,
depBaseOptions, new DeploymentSyncOptions());
}
where
var deployBaseOptions = new DeploymentBaseOptions
{
ComputerName = #"https://WIN-CCDDFDFDFD:8172/msdeploy.axd",
UserName = #"WIN-CCDDFDFDFD\Al",
Password = "1212121",
AuthenticationType = "Basic"
};
appPath = "C:\mySite.zip";

How to kill command line server for IE server in webdriver

Please guide me how to kill instances of IE driver . After i run test and on its completion browser is getting quit since i have used driver.quit().But found that instances are still up while cross checking in the task manager.
skelton of code:
driver=new InternetExplorerDriver(); //calling IE driver
testRun(); // run my test
driver.quit();
Thanks in advance
I've a method for you,
public void ieKiller() throws Exception
{
final String KILL = "taskkill /IM ";
String processName = "IEDriverServer.exe"; //IE process
Runtime.getRuntime().exec(KILL + processName);
Wait(3000); //Allow OS to kill the process
}
source

sample/tutorial of using selenium 2.0 web driver in .net?

is there any tutorial/sample for using selenium 2.0 web driver with .net ?
I've tried searching but could find only java, nothing about .net and selenium 2.0 web driver
The docs here has an example in C#:
http://seleniumhq.org/docs/03_webdriver.html
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium;
class GoogleSuggest
{
static void Main(string[] args)
{
IWebDriver driver = new FirefoxDriver();
//Notice navigation is slightly different than the Java version
//This is because 'get' is a keyword in C#
driver.Navigate().GoToUrl("http://www.google.com/");
IWebElement query = driver.FindElement(By.Name("q"));
query.SendKeys("Cheese");
System.Console.WriteLine("Page title is: " + driver.Title);
driver.Quit();
}
}
Download latest package: http://selenium-release.storage.googleapis.com/index.html
Try here: http://selenium.googlecode.com/svn/trunk/docs/api/dotnet/index.html
There is also documentation in the archive with .net bindings here: http://code.google.com/p/selenium/downloads/detail?name=selenium-dotnet-2.31.2.zip&can=2&q=label%3AFeatured
Hope it helps you

Resources