Commit e9a8ac49 authored by 黄奎's avatar 黄奎

页面修改

parent 9c911c37
...@@ -259,21 +259,23 @@ namespace TicketSpider.Spiders.ClassInRule ...@@ -259,21 +259,23 @@ namespace TicketSpider.Spiders.ClassInRule
{ {
//等待滑块加载 //等待滑块加载
Thread.Sleep(5000); Thread.Sleep(5000);
var dirpath = $"{Environment.CurrentDirectory}\\geetest";
if (!Directory.Exists(dirpath))
{
Directory.CreateDirectory(dirpath);
}
driver.SwitchTo().Frame(driver.FindElement(By.Id("tcaptcha_iframe"))); driver.SwitchTo().Frame(driver.FindElement(By.Id("tcaptcha_iframe")));
((IJavaScriptExecutor)driver).ExecuteScript("document.getElementById(\"slideBlock\").style.display = 'none';"); ((IJavaScriptExecutor)driver).ExecuteScript("document.getElementById(\"slideBlock\").style.display = 'none';");
var bgPng = ((ITakesScreenshot)driver.FindElement(By.Id("slideBg"))).GetScreenshot(); var bgPng = ((ITakesScreenshot)driver.FindElement(By.Id("slideBg"))).GetScreenshot();
var fileBgPath = $"{dirpath}\\{DateTime.Now.Ticks}.png";
bgPng.SaveAsFile(fileBgPath, ScreenshotImageFormat.Png);
((IJavaScriptExecutor)driver).ExecuteScript("document.getElementById(\"slideBlock\").style.display = 'block';document.getElementById(\"slideBg\").style.opacity = 0;"); ((IJavaScriptExecutor)driver).ExecuteScript("document.getElementById(\"slideBlock\").style.display = 'block';document.getElementById(\"slideBg\").style.opacity = 0;");
var blockPng = ((ITakesScreenshot)driver.FindElement(By.Id("slideBlock"))).GetScreenshot(); var blockPng = ((ITakesScreenshot)driver.FindElement(By.Id("slideBlock"))).GetScreenshot();
((IJavaScriptExecutor)driver).ExecuteScript("document.getElementById(\"slideBg\").style.opacity = 1;"); ((IJavaScriptExecutor)driver).ExecuteScript("document.getElementById(\"slideBg\").style.opacity = 1;");
var dirpath = $"{Environment.CurrentDirectory}\\geetest";
if (!Directory.Exists(dirpath))
{
Directory.CreateDirectory(dirpath);
}
var fileBgPath = $"{dirpath}\\{DateTime.Now.Ticks}.png";
var fileBlockPath = $"{dirpath}\\{DateTime.Now.Ticks }__1.png"; var fileBlockPath = $"{dirpath}\\{DateTime.Now.Ticks }__1.png";
bgPng.SaveAsFile(fileBgPath, ScreenshotImageFormat.Png);
blockPng.SaveAsFile(fileBlockPath, ScreenshotImageFormat.Png); blockPng.SaveAsFile(fileBlockPath, ScreenshotImageFormat.Png);
var bgX = FireFoxGetBoundary(fileBgPath, fileBlockPath); var bgX = FireFoxGetBoundary(fileBgPath, fileBlockPath);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment