-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebDriverExecutor.cs
36 lines (32 loc) · 1009 Bytes
/
WebDriverExecutor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.ComponentModel;
using OpenQA.Selenium;
using ProtoTest.Specter;
namespace Golem.Framework.Specter
{
public class WebDriverExecutor
{
private readonly BackgroundWorker worker;
public string command;
public IWebDriver driver;
public string param;
public string xpath;
public WebDriverExecutor(IWebDriver driver, string xpath, string command, string param)
{
this.driver = driver;
this.command = command;
this.xpath = xpath;
this.param = param;
worker = new BackgroundWorker();
}
public void Execute()
{
worker.DoWork += ExecuteCommand;
worker.RunWorkerAsync();
}
private void ExecuteCommand(object sender, DoWorkEventArgs e)
{
Program.Log(command + " " + param + ": " + xpath);
driver.FindElement(By.XPath(xpath)).ExecuteCommandByString(command, param);
}
}
}