-
Notifications
You must be signed in to change notification settings - Fork 0
/
SeleniumTech.cs
44 lines (38 loc) · 1.61 KB
/
SeleniumTech.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
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Text;
using OpenQA.Selenium;
namespace ZipWork
{
class SeleniumTech
{
public void TestNewCode(string UrlPath)
{
using (var driver = new OpenQA.Selenium.Chrome.ChromeDriver())
{
UrlPath = "https://privatepath.co.uk/browse/" + UrlPath;
driver.Navigate().GoToUrl(UrlPath);
System.Threading.Thread.Sleep(15000);
IWebElement PageButton = driver.FindElementById("opsbar-opsbar-transitions");
var myButton = PageButton.FindElement(By.Id("action_id_91"));
myButton.Click();
IWebElement PageButton2 = driver.FindElementByClassName("buttons");
var myButton2 = PageButton2.FindElement(By.ClassName("aui-button"));
myButton2.Click();
IWebElement PageElements = driver.FindElement(By.ClassName("item-attachments"));
var myAttach = PageElements.FindElements(By.TagName("li"));
foreach (var item in myAttach)
{
Console.WriteLine(item.Text);
Console.WriteLine(item.GetAttribute("data-downloadurl").ToString());
if (item.GetAttribute("data-downloadurl").ToString().StartsWith("application/zip:"))
{
item.Click();
System.Threading.Thread.Sleep(1000);
Console.WriteLine("Downloading File...");
}
}
}
}
}
}