{"id":180357,"date":"2013-05-21T10:30:03","date_gmt":"2013-05-21T06:30:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=180357"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=180357","title":{"rendered":"<span class=\"post_title\">\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (MS Unit Testing Framework + Selenium WebDriver C#). \u0427\u0430\u0441\u0442\u044c 2.2: Selenium API wrapper \u2014 WebElement<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/i021.radikal.ru\/1305\/9a\/a6292e0e1eae.png\" alt=\"Selenium + C#\"\/>  <\/p>\n<h5>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h5>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442! \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 Selenium WebDriver, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u043b \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 Browser. \u0412\u0440\u043e\u0434\u0435 \u0431\u044b\u043b\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e, \u0434\u0430?) \u041d\u0443 \u0447\u0442\u043e \u0436, \u0438\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435. \u041d\u0430\u0434\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u043c\u0438\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438:  <\/p>\n<ul>\n<li>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441 \u0435\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u043e\u043c, \u0442.\u0435. \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u041e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f getter \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u042d\u0442\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u043e \u0438 \u043f\u043b\u043e\u0445\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/li>\n<li>ISearchContext.FindElements \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f\u0430 OpenQA.Selenium.By, \u0442.\u0435. \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0449\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e, \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c<\/li>\n<li>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043c\u043d\u043e\u0433\u0438\u0445, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: Exist, SetText, Select, SetCheck, InnerHtml \u0438 \u0442.\u0434. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c\u0441\u044f Click, SendKeys \u0438 Text<\/li>\n<li>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 Firefox \u0438 Chrome \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043b\u0438\u043a\u0430\u0435\u0442\u0441\u044f, \u0430 \u043d\u0430 IE \u2014 \u043d\u0435\u0442. \u041f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c special cases, \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u0438\u00bb<\/li>\n<li>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0414\u0430, \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u043e. \u0412\u043f\u0435\u0440\u0435\u0434\u0438 \u043f\u043b\u0430\u043d\u0435\u0442\u044b \u0432\u0441\u0435\u0439 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e IE \u2014 \u043f\u043e\u0438\u0441\u043a \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0438\u043d\u043e\u0433\u0434\u0430 \u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0441\u0435\u043a\u0443\u043d\u0434<\/li>\n<\/ul>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c wrapper WebElement, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442.\u0435. \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u043e\u0432. \u041f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c, \u0447\u0442\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u043e\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u00ab\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u00bb, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u044b \u043f\u043e \u0440\u0443\u0447\u043d\u043e\u043c\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u043e\u0432. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u0435 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u043d\u043d \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u0430\u043c\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0438 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u0432\u043d\u0443\u0442\u0440\u0438. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u043e\u043d \u0431\u044b\u043b \u043f\u0440\u043e\u0441\u0442 \u043a\u0430\u043a \u0442\u0440\u0438 \u0431\u0443\u043a\u0432\u044b. \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e, \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043c\u0430\u043b\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a =)<a name=\"habracut\"><\/a><\/p>\n<h5>\u0412\u043f\u0435\u0440\u0435\u0434!<\/h5>\n<p>  \u0418 \u0442\u0430\u043a, \u044f \u043d\u0430\u0447\u0430\u043b \u0434\u0443\u043c\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043d\u0435, \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u043e\u0432, \u0431\u044b\u043b\u043e \u0431\u044b \u0443\u0434\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c web-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u041f\u0435\u0440\u0432\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0440\u0435\u0448\u0430\u044e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c getter&#8217;\u043e\u0432, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cs\">private IWebElement LoginEdit { \tget \t{ \t\treturn WebDriver.FindElement(By.Id(&quot;Login&quot;)); \t} } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043d\u0435\u0442, \u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043d\u0430\u0431\u043e\u0440\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c FindElements, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0441\u0435\u0438\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e GetAttribute \u0438 GetCssValue.<\/p>\n<p>  \u0412 WebDriver.Support \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0444\u0438\u0447\u0430, \u043a\u0430\u043a PageFactory \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 FindsBy:  <\/p>\n<pre><code class=\"cs\">[FindsBy(How = How.LinkText, Using = &quot;\u0421\u043f\u0440\u0430\u0432\u043a\u0430&quot;)] public IWebElement HelpLink { get; set; } <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u2014 \u043d\u0435\u043f\u043b\u043e\u0445\u043e. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a (CacheLookup). \u041c\u0438\u043d\u0443\u0441\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f:  <\/p>\n<ul>\n<li>\u041f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438 getter (\u043d\u0443 \u043c\u043e\u0436\u043d\u043e \u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435?)<\/li>\n<li>PageFactory.InitElements \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043d\u044e\u0430\u043d\u0441\u044b. \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 (\u043d\u0435 \u0445\u043e\u0447\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u0435\u043c\u00bb).<\/li>\n<li>IWebElement \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0442\u043e\u0440\u0447\u0438\u0442 \u043d\u0430\u0440\u0443\u0436\u0443 (\u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043e\u043d public), \u0430 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u043a\u0430\u043a \u0435\u043c\u0443 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u043e.<\/li>\n<\/ul>\n<p>  \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043d\u043e\u0433\u0438\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f. \u041c\u044b \u0436\u0435 \u043f\u043e\u0439\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435. \u0421\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u0443\u044e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0444\u0438\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435.<\/p>\n<h5>\u0418\u0434\u0435\u044f \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h5>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430, \u0430 \u0441\u0430\u043c \u043f\u043e\u0438\u0441\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0438 \u043b\u044e\u0431\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0445 \u0441 \u043d\u0438\u043c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u0434\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443, \u043d\u043e \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u0418 \u0442\u0443\u0442 \u043a\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f \u043a\u0441\u0442\u0430\u0442\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u00ab\u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432\u00bb (call chain). \u0415\u0449\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043a\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>  \u041d\u0443 \u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u0447\u0430\u0441\u0442\u044c\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043d\u0430\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0432 \u0441\u0442\u0438\u043b\u0435 Linq, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0447\u0435\u043a\u0431\u043e\u043a\u0441\u044b \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443-\u043b\u0438\u0431\u043e \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e \u0438\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0441\u044b\u043b\u043e\u043a.<\/p>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0441\u0445\u0435\u043c\u0443 WebElement:<br \/>  <img decoding=\"async\" src=\"http:\/\/s60.radikal.ru\/i167\/1305\/70\/5dc589151d48.png\" alt=\"image\"\/><\/p>\n<p>  \u0417\u0430\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u0441\u0438\u0442\u0446\u0430\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0433\u0434\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Selenium WebDriver. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043c\u0435\u0442\u043e\u0434 Browser.ExecuteJavaScript (\u0441\u043c. \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e), \u0442.\u0435. \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 JavaScript \u0438 JQuery.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u043a\u043e\u0434\u0443 wrapper&#8217;\u0430, \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f:<\/p>\n<p>  \u041f\u043e\u0438\u0441\u043a \u043f\u043e id:  <\/p>\n<pre><code class=\"cs\">private static readonly WebElement TestElement = new WebElement().ById(&quot;StartButton&quot;); <\/code><\/pre>\n<p>  \u041f\u043e\u0438\u0441\u043a \u043f\u043e XPath:  <\/p>\n<pre><code class=\"cs\">private static readonly WebElement TestElement = new WebElement().ByXPath(&quot;\/\/div[@class='Content']\/\/tr[2]\/td[2]&quot;); <\/code><\/pre>\n<p>  \u041f\u043e\u0438\u0441\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0443:  <\/p>\n<pre><code class=\"cs\">private static readonly WebElement TestElement = new WebElement().ByClass(&quot;UserAvatar&quot;).Last(); <\/code><\/pre>\n<p>  \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442:  <\/p>\n<pre><code class=\"cs\">private static readonly WebElement TestElement = new WebElement().ByAttribute(TagAttributes.Href, &quot;TagEdit&quot;, exactMatch: false); <\/code><\/pre>\n<p>  \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c:  <\/p>\n<pre><code class=\"cs\">private static readonly WebElement TestElement = new WebElement().ByClass(&quot;TimePart&quot;).ByName(&quot;Day&quot;).Index(0); <\/code><\/pre>\n<p>  \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0442\u044d\u0433\u0443 \u0438 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 (\u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e):  <\/p>\n<pre><code class=\"cs\">private static readonly WebElement TestElement = new WebElement().ByTagName(TagNames.Link).ByText(&quot;Hello&quot;, exactMach) <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0432 TestElement \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 (\u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442). \u0422\u0430\u043a \u0436\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Index(&#8230;), \u043b\u0438\u0431\u043e First() \u0438\u043b\u0438 Last(), \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043d\u0430\u0448\u0435\u043b\u0441\u044f \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043e\u0434\u043d\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u0440\u0430\u0437\u0443 (\u0441\u043c. ForEach \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043d\u0438\u0436\u0435).<\/p>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<p>  \u041a\u043b\u0438\u043a \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443  <\/p>\n<pre><code class=\"cs\">TestElement.Click(); <\/code><\/pre>\n<p>  \u041a\u043b\u0438\u043a \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Selenium WebDriver \u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JQuery:  <\/p>\n<pre><code class=\"cs\">TestElement.Click(useJQuery: true); <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0441\u044b\u043b\u043a\u0438 \u0438\u043b\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f):  <\/p>\n<pre><code class=\"cs\">var text = TestElement.Text; <\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0430:  <\/p>\n<pre><code class=\"cs\">TestElement.Text = &quot;Hello!&quot;; <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442:  <\/p>\n<pre><code class=\"cs\">TestElement1.DragAndDrop(TestElement2); <\/code><\/pre>\n<p>  \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443:  <\/p>\n<pre><code class=\"cs\">TestElement.FireJQueryEvent(JavaScriptEvents.KeyUp); <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0441\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (\u043a\u043b\u0438\u043a \u043f\u043e \u043f\u043b\u044e\u0441\u0438\u043a\u0430\u043c):  <\/p>\n<pre><code class=\"cs\">TestElements.ForEach(i =&gt; i.Click()); <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432:  <\/p>\n<pre><code class=\"cs\">var subjects = new WebElement().ByClass(&quot;Subject&quot;).Select(i =&gt; i.Text); <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d call chain \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435:  <\/p>\n<pre><code class=\"cs\">new WebElement().ById(&quot;Next&quot;).Click(); var text = new WebElement().ById(&quot;Help&quot;).Text; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u0442\u0440\u0430\u043d\u0438\u0446) \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u043e, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438? \u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0442\u043e\u0440\u0447\u0438\u0442 \u043d\u0430\u0440\u0443\u0436\u0443. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u0434\u0430\u0436\u0435 \u043d\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0442\u044d\u0433\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e enum TagAttributes \u0438 TagNames. \u042d\u0442\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442 \u043a\u043e\u0434 \u043e\u0442 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 magic strings.<\/p>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 API, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u041a\u043b\u0430\u0441\u0441 WebElement (partial) \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0442 \u043d\u0430 5 \u0447\u0430\u0441\u0442\u0435\u0439:  <\/p>\n<ul>\n<li>WebElement.cs<\/li>\n<li>WebElementActions.cs<\/li>\n<li>WebElementByCriteria.cs<\/li>\n<li>WebElementExceptions.cs<\/li>\n<li>WebElementFilters.cs<\/li>\n<\/ul>\n<p>  \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u043b \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0432 \u043a\u043e\u0434\u0435 \u043d\u0435\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432, \u043d\u043e \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043f\u0440\u043e\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0434 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u043e\u0439.<\/p>\n<h5>WebElement.cs<\/h5>\n<p>  <\/p>\n<pre><code class=\"cs\">namespace Autotests.Utilities.WebElement {     public partial class WebElement : ICloneable     {         private By _firstSelector;         private IList&lt;IWebElement&gt; _searchCache;          private IWebElement FindSingle()         {             return TryFindSingle();         }          private IWebElement TryFindSingle()         {             Contract.Ensures(Contract.Result&lt;IWebElement&gt;() != null);              try             {                 return FindSingleIWebElement();             }             catch (StaleElementReferenceException)             {                 ClearSearchResultCache();                  return FindSingleIWebElement();             }             catch (InvalidSelectorException)             {                 throw;             }             catch (WebDriverException)             {                 throw;             }             catch (WebElementNotFoundException)             {                 throw;             }             catch             {                 throw WebElementNotFoundException;             }         }          private IWebElement FindSingleIWebElement()         {             var elements = FindIWebElements();              if (!elements.Any()) throw WebElementNotFoundException;              var element = elements.Count() == 1                 ? elements.Single()                 : _index == -1                     ? elements.Last()                     : elements.ElementAt(_index);             \/\/ ReSharper disable UnusedVariable             var elementAccess = element.Enabled;             \/\/ ReSharper restore UnusedVariable              return element;         }          private IList&lt;IWebElement&gt; FindIWebElements()         {             if (_searchCache != null)             {                 return _searchCache;             }              Browser.WaitReadyState();             Browser.WaitAjax();              var resultEnumerable = Browser.FindElements(_firstSelector);              try             {                 resultEnumerable = FilterByVisibility(resultEnumerable).ToList();                 resultEnumerable = FilterByTagNames(resultEnumerable).ToList();                 resultEnumerable = FilterByText(resultEnumerable).ToList();                 resultEnumerable = FilterByTagAttributes(resultEnumerable).ToList();                 resultEnumerable = resultEnumerable.ToList();             }             catch (Exception e)             {                 Console.WriteLine(e);                  return new List&lt;IWebElement&gt;();             }              var resultList = resultEnumerable.ToList();              return resultList;         }          private WebElementNotFoundException WebElementNotFoundException         {             get             {                 CheckConnectionFailure();                  return new WebElementNotFoundException(string.Format(&quot;Can't find single element with given search criteria: {0}.&quot;,                     SearchCriteriaToString()));             }         }          private static void CheckConnectionFailure()         {             const string connectionFailure = &quot;connectionFailure&quot;;              Contract.Assert(!Browser.PageSource.Contains(connectionFailure),                 &quot;Connection can't be established.&quot;);         }          object ICloneable.Clone()         {             return Clone();         }          public WebElement Clone()         {             return (WebElement)MemberwiseClone();         }     } } <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 FindIWebElements, FindSingleIWebElement \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432 TryFindSingle. \u0412 FindIWebElements \u043c\u044b \u0434\u043e\u0436\u0438\u0434\u0430\u0435\u043c\u0441\u044f, \u043f\u043e\u043a\u0430 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0432\u0441\u0435 \u0441\u0432\u043e\u0438 \u0434\u0435\u043b\u0430 (WaitReadyState \u0438 WaitAjax), \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u0438\u0441\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (FindElements), \u0430 \u0437\u0430\u0442\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0438\u0445 \u043f\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c. \u0422\u0430\u043a\u0436\u0435 \u0432 \u043a\u043e\u0434\u0435 \u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442 _searchCache, \u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u0448 \u043a\u044d\u0448 (\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0438\u0441\u043a \u043d\u0435 \u043a\u044d\u0448\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 CacheSearchResult).<\/p>\n<h5>WebElementActions.cs<\/h5>\n<p>  <\/p>\n<pre><code class=\"cs\">namespace Autotests.Utilities.WebElement {     internal enum SelectTypes     {         ByValue,         ByText     }      public partial class WebElement     {         #region Common properties          public int Count         {             get { return FindIWebElements().Count; }         }          public bool Enabled         {             get { return FindSingle().Enabled; }         }          public bool Displayed         {             get { return FindSingle().Displayed; }         }          public bool Selected         {             get { return FindSingle().Selected; }         }          public string Text         {             set             {                 var element = FindSingle();                  if (element.TagName == EnumHelper.GetEnumDescription(TagNames.Input) || element.TagName == EnumHelper.GetEnumDescription(TagNames.TextArea))                 {                     element.Clear();                 }                 else                 {                     element.SendKeys(Keys.LeftControl + &quot;a&quot;);                     element.SendKeys(Keys.Delete);                 }                  if (string.IsNullOrEmpty(value)) return;                  Browser.ExecuteJavaScript(string.Format(&quot;arguments[0].value = \\&quot;{0}\\&quot;;&quot;, value), element);                  Executor.Try(() =&gt; FireJQueryEvent(JavaScriptEvents.KeyUp));             }             get             {                 var element = FindSingle();                                  return !string.IsNullOrEmpty(element.Text) ? element.Text : element.GetAttribute(EnumHelper.GetEnumDescription(TagAttributes.Value));             }         }          public int TextInt         {             set { Text = value.ToString(CultureInfo.InvariantCulture); }             get { return Text.ToInt(); }         }          public string InnerHtml         {             get { return Browser.ExecuteJavaScript(&quot;return arguments[0].innerHTML;&quot;, FindSingle()).ToString(); }         }          #endregion          #region Common methods          public bool Exists()         {             return FindIWebElements().Any();         }          public bool Exists(TimeSpan timeSpan)         {             return Executor.SpinWait(Exists, timeSpan, TimeSpan.FromMilliseconds(200));         }          public bool Exists(int seconds)         {             return Executor.SpinWait(Exists, TimeSpan.FromSeconds(seconds), TimeSpan.FromMilliseconds(200));         }          public void Click(bool useJQuery = true)         {             var element = FindSingle();              Contract.Assert(element.Enabled);              if (useJQuery && element.TagName != EnumHelper.GetEnumDescription(TagNames.Link))             {                 FireJQueryEvent(element, JavaScriptEvents.Click);             }             else             {                 try                 {                     element.Click();                 }                 catch (InvalidOperationException e)                 {                     if (e.Message.Contains(&quot;Element is not clickable&quot;))                     {                         Thread.Sleep(2000);                         element.Click();                     }                 }             }         }          public void SendKeys(string keys)         {             FindSingle().SendKeys(keys);         }          public void SetCheck(bool value, bool useJQuery = true)         {             var element = FindSingle();              Contract.Assert(element.Enabled);              const int tryCount = 10;              for (var i = 0; i &lt; tryCount; i++)             {                 element = FindSingle();                  Set(value, useJQuery);                  if (element.Selected == value)                 {                     return;                 }             }              Contract.Assert(element.Selected == value);         }          public void Select(string optionValue)         {             SelectCommon(optionValue, SelectTypes.ByValue);         }          public void Select(int optionValue)         {             SelectCommon(optionValue.ToString(CultureInfo.InvariantCulture), SelectTypes.ByValue);         }          public void SelectByText(string optionText)         {             SelectCommon(optionText, SelectTypes.ByText);         }          public string GetAttribute(TagAttributes tagAttribute)         {             return FindSingle().GetAttribute(EnumHelper.GetEnumDescription(tagAttribute));         }          #endregion          #region Additional methods          public void SwitchContext()         {             var element = FindSingle();              Browser.SwitchToFrame(element);         }              public void CacheSearchResult()         {             _searchCache = FindIWebElements();         }          public void ClearSearchResultCache()         {             _searchCache = null;         }          public void DragAndDrop(WebElement destination)         {             var source = FindSingle();             var dest = destination.FindSingle();              Browser.DragAndDrop(source, dest);         }          public void FireJQueryEvent(JavaScriptEvents javaScriptEvent)         {             var element = FindSingle();              FireJQueryEvent(element, javaScriptEvent);         }          public void ForEach(Action&lt;WebElement&gt; action)         {             Contract.Requires(action != null);              CacheSearchResult();              Enumerable.Range(0, Count).ToList().ForEach(i =&gt; action(ByIndex(i)));              ClearSearchResultCache();         }          public List&lt;T&gt; Select&lt;T&gt;(Func&lt;WebElement, T&gt; action)         {             Contract.Requires(action != null);              var result = new List&lt;T&gt;();                          ForEach(e =&gt; result.Add(action(e)));              return result;         }          public List&lt;WebElement&gt; Where(Func&lt;WebElement, bool&gt; action)         {             Contract.Requires(action != null);              var result = new List&lt;WebElement&gt;();              ForEach(e =&gt;                 {                     if (action(e)) result.Add(e);                 });              return result;         }          public WebElement Single(Func&lt;WebElement, bool&gt; action)         {             return Where(action).Single();         }          #endregion          #region Helpers          private void Set(bool value, bool useJQuery = true)         {             if (Selected ^ value)             {                 Click(useJQuery);             }         }          private void SelectCommon(string option, SelectTypes selectType)         {             Contract.Requires(!string.IsNullOrEmpty(option));              var element = FindSingle();              Contract.Assert(element.Enabled);              switch (selectType)             {                 case SelectTypes.ByValue:                     new SelectElement(element).SelectByValue(option);                     return;                 case SelectTypes.ByText:                     new SelectElement(element).SelectByText(option);                     return;                 default:                     throw new Exception(string.Format(&quot;Unknown select type: {0}.&quot;, selectType));             }                     }          private void FireJQueryEvent(IWebElement element, JavaScriptEvents javaScriptEvent)         {             var eventName = EnumHelper.GetEnumDescription(javaScriptEvent);              Browser.ExecuteJavaScript(string.Format(&quot;$(arguments[0]).{0}();&quot;, eventName), element);         }          #endregion     }      public enum JavaScriptEvents     {         [Description(&quot;keyup&quot;)]         KeyUp,          [Description(&quot;click&quot;)]         Click     } } <\/code><\/pre>\n<p>  \u041f\u043b\u043e\u0441\u043a\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 useJQuery, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u0443, \u0447\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JQuery (\u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432\u043e \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445). \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 JavaScript \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u0438\u00bb, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0446\u0438\u043a\u043b \u0441 tryCount \u0432 SetCheck. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u0432\u043e\u0438 special cases.<\/p>\n<h5>WebElementByCriteria.cs<\/h5>\n<p>  <\/p>\n<pre><code class=\"cs\">namespace Autotests.Utilities.WebElement {     internal class SearchProperty     {         public string AttributeName { get; set; }         public string AttributeValue { get; set; }         public bool ExactMatch { get; set; }     }      internal class TextSearchData     {         public string Text { get; set; }         public bool ExactMatch { get; set; }     }      public partial class WebElement     {         private readonly IList&lt;SearchProperty&gt; _searchProperties = new List&lt;SearchProperty&gt;();         private readonly IList&lt;TagNames&gt; _searchTags = new List&lt;TagNames&gt;();         private bool _searchHidden;         private int _index;         private string _xPath;         private TextSearchData _textSearchData;          public WebElement ByAttribute(TagAttributes tagAttribute, string attributeValue, bool exactMatch = true)         {             return ByAttribute(EnumHelper.GetEnumDescription(tagAttribute), attributeValue, exactMatch);         }          public WebElement ByAttribute(TagAttributes tagAttribute, int attributeValue, bool exactMatch = true)         {             return ByAttribute(EnumHelper.GetEnumDescription(tagAttribute), attributeValue.ToString(), exactMatch);         }          public WebElement ById(string id, bool exactMatch = true)         {             return ByAttribute(TagAttributes.Id, id, exactMatch);         }          public WebElement ById(int id, bool exactMatch = true)         {             return ByAttribute(TagAttributes.Id, id.ToString(), exactMatch);         }          public WebElement ByName(string name, bool exactMatch = true)         {             return ByAttribute(TagAttributes.Name, name, exactMatch);         }          public WebElement ByClass(string className, bool exactMatch = true)         {             return ByAttribute(TagAttributes.Class, className, exactMatch);         }          public WebElement ByTagName(TagNames tagName)         {             var selector = By.TagName(EnumHelper.GetEnumDescription(tagName));              _firstSelector = _firstSelector ?? selector;             _searchTags.Add(tagName);              return this;         }          public WebElement ByXPath(string xPath)         {             Contract.Assume(_firstSelector == null,                 &quot;XPath can be only the first search criteria.&quot;);              _firstSelector = By.XPath(xPath);             _xPath = xPath;              return this;         }          public WebElement ByIndex(int index)         {             _index = index;              return this;         }          public WebElement First()         {             _index = 0;              return this;         }          public WebElement Last()         {             _index = -1;              return this;         }          public WebElement IncludeHidden()         {             _searchHidden = true;              return this;         }          public WebElement ByText(string text, bool exactMatch = true)         {             var selector = exactMatch ?                 By.XPath(string.Format(&quot;\/\/*[text()=\\&quot;{0}\\&quot;]&quot;, text)) :                 By.XPath(string.Format(&quot;\/\/*[contains(text(), \\&quot;{0}\\&quot;)]&quot;, text));              _firstSelector = _firstSelector ?? selector;             _textSearchData = new TextSearchData { Text = text, ExactMatch = exactMatch };              return this;         }          private WebElement ByAttribute(string tagAttribute, string attributeValue, bool exactMatch = true)         {             var xPath = exactMatch ?                         string.Format(&quot;\/\/*[@{0}=\\&quot;{1}\\&quot;]&quot;, tagAttribute, attributeValue) :                         string.Format(&quot;\/\/*[contains(@{0}, \\&quot;{1}\\&quot;)]&quot;, tagAttribute, attributeValue);             var selector = By.XPath(xPath);              _firstSelector = _firstSelector ?? selector;              _searchProperties.Add(new SearchProperty                 {                     AttributeName = tagAttribute,                     AttributeValue = attributeValue,                     ExactMatch = exactMatch                 });              return this;         }          private string SearchCriteriaToString()         {             var result = _searchProperties.Select(searchProperty =&gt;                 string.Format(&quot;{0}: {1} ({2})&quot;,                     searchProperty.AttributeName,                     searchProperty.AttributeValue,                     searchProperty.ExactMatch ? &quot;exact&quot; : &quot;contains&quot;)).ToList();              result.AddRange(_searchTags.Select(searchTag =&gt;                 string.Format(&quot;tag: {0}&quot;, searchTag)));              if (_xPath != null)             {                 result.Add(string.Format(&quot;XPath: {0}&quot;, _xPath));             }              if (_textSearchData != null)             {                 result.Add(string.Format(&quot;text: {0} ({1})&quot;,                     _textSearchData.Text,                     _textSearchData.ExactMatch ? &quot;exact&quot; : &quot;contains&quot;));             }              return string.Join(&quot;, &quot;, result);         }     } } <\/code><\/pre>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435, \u0441 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u0432\u043e\u0438\u0445 \u0442\u0435\u0441\u0442\u0430\u0445. \u041f\u043e\u0447\u0442\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0435\u0432 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e (exactMatch). \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a XPath (\u0438 \u044f \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044e, \u0447\u0442\u043e XPath \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430, \u043d\u043e \u043b\u0438\u0447\u043d\u043e \u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b).<\/p>\n<h5>WebElementExceptions.cs<\/h5>\n<p>  <\/p>\n<pre><code class=\"cs\">namespace Autotests.Utilities.WebElement {     public class WebElementNotFoundException : Exception     {         public WebElementNotFoundException(string message) : base(message)         {         }     } } <\/code><\/pre>\n<p>  \u041d\u0443 \u0442\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0434\u043d\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<h5>WebElementFilters.cs<\/h5>\n<p>  <\/p>\n<pre><code class=\"cs\">namespace Autotests.Utilities.WebElement {     public partial class WebElement     {         private IEnumerable&lt;IWebElement&gt; FilterByVisibility(IEnumerable&lt;IWebElement&gt; result)         {             return !_searchHidden ? result.Where(item =&gt; item.Displayed) : result;         }          private IEnumerable&lt;IWebElement&gt; FilterByTagNames(IEnumerable&lt;IWebElement&gt; elements)         {             return _searchTags.Aggregate(elements, (current, tag) =&gt; current.Where(item =&gt; item.TagName == EnumHelper.GetEnumDescription(tag)));         }          private IEnumerable&lt;IWebElement&gt; FilterByText(IEnumerable&lt;IWebElement&gt; result)         {             if (_textSearchData != null)             {                 result = _textSearchData.ExactMatch                     ? result.Where(item =&gt; item.Text == _textSearchData.Text)                     : result.Where(item =&gt; item.Text.Contains(_textSearchData.Text, StringComparison.InvariantCultureIgnoreCase));             }              return result;         }          private IEnumerable&lt;IWebElement&gt; FilterByTagAttributes(IEnumerable&lt;IWebElement&gt; elements)         {             return _searchProperties.Aggregate(elements, FilterByTagAttribute);         }          private static IEnumerable&lt;IWebElement&gt; FilterByTagAttribute(IEnumerable&lt;IWebElement&gt; elements, SearchProperty searchProperty)         {             return searchProperty.ExactMatch ?                 elements.Where(item =&gt; item.GetAttribute(searchProperty.AttributeName) != null && item.GetAttribute(searchProperty.AttributeName).Equals(searchProperty.AttributeValue)) :                 elements.Where(item =&gt; item.GetAttribute(searchProperty.AttributeName) != null && item.GetAttribute(searchProperty.AttributeName).Contains(searchProperty.AttributeValue));         }     } } <\/code><\/pre>\n<p>  \u0424\u0438\u043b\u044c\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 FindIWebElements (\u0444\u0430\u0439\u043b WebElement.cs) \u0434\u043b\u044f \u043e\u0442\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0417\u0430\u043c\u0435\u0447\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043d\u0430\u0431\u043e\u0440\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 Linq \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c for \u0438 foreach, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0446\u0438\u043a\u043b\u043e\u0432.<\/p>\n<h5>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h5>\n<p>  \u0411\u0443\u0434\u0443 \u0440\u0430\u0437 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u041b\u0421 \u043e\u0448\u0438\u0431\u043a\u0438, \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043b\u044e\u0431\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/180357\/\"> http:\/\/habrahabr.ru\/post\/180357\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/i021.radikal.ru\/1305\/9a\/a6292e0e1eae.png\" alt=\"Selenium + C#\"\/>  <\/p>\n<h5>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h5>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442! \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 Selenium WebDriver, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u043b \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 Browser. \u0412\u0440\u043e\u0434\u0435 \u0431\u044b\u043b\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e, \u0434\u0430?) \u041d\u0443 \u0447\u0442\u043e \u0436, \u0438\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435. \u041d\u0430\u0434\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u043c\u0438\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438:  <\/p>\n<ul>\n<li>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441 \u0435\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u043e\u043c, \u0442.\u0435. \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u041e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f getter \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u042d\u0442\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u043e \u0438 \u043f\u043b\u043e\u0445\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/li>\n<li>ISearchContext.FindElements \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f\u0430 OpenQA.Selenium.By, \u0442.\u0435. \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0449\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e, \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c<\/li>\n<li>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043c\u043d\u043e\u0433\u0438\u0445, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: Exist, SetText, Select, SetCheck, InnerHtml \u0438 \u0442.\u0434. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c\u0441\u044f Click, SendKeys \u0438 Text<\/li>\n<li>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 Firefox \u0438 Chrome \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043b\u0438\u043a\u0430\u0435\u0442\u0441\u044f, \u0430 \u043d\u0430 IE \u2014 \u043d\u0435\u0442. \u041f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c special cases, \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u0438\u00bb<\/li>\n<li>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0414\u0430, \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u043e. \u0412\u043f\u0435\u0440\u0435\u0434\u0438 \u043f\u043b\u0430\u043d\u0435\u0442\u044b \u0432\u0441\u0435\u0439 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e IE \u2014 \u043f\u043e\u0438\u0441\u043a \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0438\u043d\u043e\u0433\u0434\u0430 \u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0441\u0435\u043a\u0443\u043d\u0434<\/li>\n<\/ul>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c wrapper WebElement, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442.\u0435. \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u043e\u0432. \u041f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c, \u0447\u0442\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u043e\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u00ab\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u00bb, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u044b \u043f\u043e \u0440\u0443\u0447\u043d\u043e\u043c\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u043e\u0432. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u0435 \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u043d\u043d \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u0430\u043c\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0438 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u0432\u043d\u0443\u0442\u0440\u0438. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u043e\u043d \u0431\u044b\u043b \u043f\u0440\u043e\u0441\u0442 \u043a\u0430\u043a \u0442\u0440\u0438 \u0431\u0443\u043a\u0432\u044b. \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e, \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043c\u0430\u043b\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a =)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-180357","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/180357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=180357"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/180357\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=180357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=180357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=180357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}