-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXpathDirectory.cs
77 lines (62 loc) · 3.45 KB
/
XpathDirectory.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
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
using System;
using System.Collections.Generic;
using System.Text;
namespace Scrappy2._0
{
class XpathDirectory : RootClass
{
public static string GetLeagueXpath(string _divisionTitle, string _leagueTitle)
{
string start = "//div[contains(@class, 'gl-MarketGroup_Wrapper sm-SplashMarketGroup_Container ')]//div[contains(@class, 'sm-SplashMarket_Title') and contains(text(), '";
string mi = _divisionTitle;
string dd = "')]/parent::div[contains(@class, 'sm-SplashMarket_Header sm-SplashMarket_HeaderOpen ')]/following-sibling::div/child::div/child::span[text() ='";
string le = _leagueTitle;
string end = "']";
string path = start + mi + dd + le + end;
return path;
}
//Returns an xPath for League Division Header Title THAT IS opened
public static string CheckOpenHeaderXpath(string _headerTitle)
{
string start = "//div[contains(@class, 'gl-MarketGroup_Wrapper sm-SplashMarketGroup_Container ')]//div[contains(@class, 'sm-SplashMarket_Title') and contains(text(), '";
string middle = _headerTitle;
string end = "')]/parent::div[contains(@class, 'sm-SplashMarket_HeaderOpen ')]";
string path = start + middle + end;
return path;
}
//Returns an xPath for League Division Header Title THAT IS NOT opened
public static string GetHeaderTitleXpath(string _headerTitle)
{
string start = "//div[contains(@class, 'gl-MarketGroup_Wrapper sm-SplashMarketGroup_Container ')]//div[contains(@class, 'sm-SplashMarket_Title') and contains(text(), '";
string middle = _headerTitle;
string end = "')]";
string path = start + middle + end;
return path;
}
public static string GetMatchXpath(string matchVariableXpath)
{
//div[contains(@class, 'rcl-ParticipantFixtureDetails_TeamNames')] / child::div[@class = 'rcl-ParticipantFixtureDetails_TeamWrapper '] / child::div[contains(text(), '
string start = " //div[contains(@class, 'rcl-ParticipantFixtureDetails_TeamNames')] / child::div[@class = 'rcl-ParticipantFixtureDetails_TeamWrapper '] / child::div[contains(text(), \"";
string middle = matchVariableXpath;
string end = "\")]";
string xPath = start + middle + end;
return xPath;
}
public static string GetOddsXpath(string index)
{
//
string start = "//div[contains(@class, 'sgl-MarketOddsExpand gl-Market_General gl-Market_General-columnheader ')]/div['";
string middle = index;
string end = "']/span";
string path = start + middle + end;
return path;
}
public static bool ScrapeThisMatch(int webElementIndex)
{
string inPlayClockPath = "//div[contains(@class, 'rcl-ParticipantFixtureDetails_Details ')]["+ webElementIndex +"]/div[contains(@class,'rcl-ParticipantFixtureDetails_Clock rcl-ParticipantFixtureDetails_Clock-wide pi-CouponParticipantClockInPlay ')]";
bool scrapeThisMatch = AWebElement(inPlayClockPath) == null ? true : false;
return scrapeThisMatch;
}
//div[contains(@class, 'rcl-ParticipantFixtureDetails_Details ')]/div[contains(@class,'rcl-ParticipantFixtureDetails_Clock rcl-ParticipantFixtureDetails_Clock-wide pi-CouponParticipantClockInPlay ')]
}
}