I want to make string copied from selenium button click. The site provides a button-like div tag. If I click the tag, then an URL copied to my clipboard. And I want that URL into string. Can Selenium make that possible? here's some code:
using System; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; ... _driverService = ChromeDriverService.CreateDefaultService(); _driverService.HideCommandPromptWindow = true; _options = new ChromeOptions(); _options.AddArgument("disable-gpu"); _options.AddArgument(String.Format("user-data-dir={0}", profilePath)); // _options.AddArgument("headless"); // headless cannot usable in WPF... why? _driver = new ChromeDriver(_driverService, _options); _driver.Navigate().GoToUrl("The site that provides what I want"); _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); var element = _driver.FindElementByXPath("The tag's xpath"); element.Click(); // I think this copy an url probably, or not. // what should I do from here? to assign that url to a string variable?
https://stackoverflow.com/questions/65778073/how-can-i-assign-string-copied-to-clipboard-after-selenium-button-click-to-a-var January 19, 2021 at 12:05AM
没有评论:
发表评论