This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try | |
| { | |
| requiredRow = _tableRows.First(d => d.FindElement(By.XPath(string.Format("td[{1}"]))).Text == knownValue); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return requiredRow.FindElement(By.XPath(string.Format("td[{0}]", FindColumnIndex(columnName)))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ScreenShotRemoteWebDriver : RemoteWebDriver, ITakesScreenshot | |
| { | |
| public ScreenShotRemoteWebDriver(Uri remoteAddress, ICapabilities desiredCapabilities) | |
| : base(remoteAddress, desiredCapabilities) | |
| { | |
| } | |
| public Screenshot GetScreenshot() | |
| { | |
| // Get the screenshot as base64. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Screenshot ss = ((ITakesScreenshot)webDriver).GetScreenshot(); | |
| string screenshot = ss.AsBase64EncodedString; | |
| byte[] screenshotAsByteArray = ss.AsByteArray; | |
| ss.SaveAsFile(@"C:\Temp", System.Drawing.Imaging.ImageFormat.Jpeg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| webDriver = new ScreenShotRemoteWebDriver(new Uri(remoteServer), capabilities); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public abstract class DefaultPage | |
| { | |
| protected IWebDriver WebDriver { get; set; } | |
| public LynxDefaultPage(IWebDriver webDriver) | |
| { | |
| WebDriver = webDriver; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Inherit the DefaultPage. | |
| public class BlogObject : DefaultPage | |
| { | |
| //Two parameters, base in your driver, and also the timeout for the page to finish loading. | |
| public BlogObject(IWebDriver webDriver, double timeout) | |
| : base(webDriver) //Pass the driver to the base class. | |
| { | |
| //Initiate the locators dictionary, and assign to private parameter. | |
| _locators = Locators(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BlogObject blogObject = new BlogObject (webDriver, 60); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using OpenQA.Selenium; | |
| using OpenQA.Selenium.Support.UI; | |
| using System; | |
| using System.Drawing.Imaging; | |
| namespace Richard.WebDriverExtensions | |
| { | |
| public static class WebDriverExtensions | |
| { | |
| /// <summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| webDriver.TakeScreenshot(@"C:\Temp\Richard.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg); |
OlderNewer