This repository was archived by the owner on Apr 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
79 lines (63 loc) · 3.03 KB
/
Copy pathProgram.cs
File metadata and controls
79 lines (63 loc) · 3.03 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Support.UI;
namespace testeSelenium
{
class Program
{
/// <summary>
/// This Class has no comments because it was meant to
/// Show me what i could do with selenium and .net core
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
string Email = "user email";
string Pass = "Password";
string BuyerEmail = "BuyerEmail";
int Value = 1;
string ItemName = "item name";
string ItemDescription = "Description of the Item";
string Notes = "THIS IS A TEST. DO NOT PAY THIS";
using (IWebDriver driver = new FirefoxDriver())
{
driver.Navigate().GoToUrl("http://www.paypal.com/signin");
IWebElement query = driver.FindElement(By.Id("email"));
query.SendKeys(Email);
query = driver.FindElement(By.Id("password"));
query.SendKeys(Pass);
query.Submit();
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(d => d.Url.Contains("paypal.com/myaccount/home"));
driver.Navigate().GoToUrl("https://www.paypal.com/invoice/create");
wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(d => d.Title.StartsWith("fatura",StringComparison.OrdinalIgnoreCase));
query = driver.FindElement(By.Id("billtotokenfield-tokenfield"));
query.SendKeys(BuyerEmail);
query = driver.FindElement(By.Id("defaultItemUnitTypeDiv"));
query.Click();
query = driver.FindElement(By.Id("justTotal"));
query.Click();
query = driver.FindElement(By.Id("itemName_0"));
query.SendKeys(ItemName);
query = driver.FindElement(By.Id("itemDescription_0"));
query.SendKeys(ItemDescription);
query = driver.FindElement(By.Id("itemPrice_0"));
query.SendKeys(Value.ToString());
IWebElement notes = driver.FindElement(By.Id("notes"));
notes.SendKeys(Notes);
((IJavaScriptExecutor)driver).ExecuteScript("window.scrollTo(0, document.body.scrollHeight - 150)");
var btns = driver.FindElements(By.Id("previewInvoice"));
IWebElement btn = btns[1];
btn.Click();
((IJavaScriptExecutor)driver).ExecuteScript("document.getElementById('header').style.display = 'none'");
IWebElement send = driver.FindElement(By.Id("sendActionButton"));
Actions a = new Actions(driver);
a.MoveToElement(send).Perform();
send.Click();
}
}
}
}