C# 尝试使用findelement关闭模式弹出窗口

C# 尝试使用findelement关闭模式弹出窗口,c#,selenium,selenium-webdriver,C#,Selenium,Selenium Webdriver,在C语言中使用Webdriver# 我正在尝试使用findelement关闭一个模式弹出窗口。不确定要使用哪个findelement来关闭模式 //HTML <div id="simplemodal-container" class="simplemodal-container" style="background-color: rgb(255, 255, 255); border-color: rgb(255, 255, 255); height: 297px; padding:

在C语言中使用Webdriver#

我正在尝试使用findelement关闭一个模式弹出窗口。不确定要使用哪个findelement来关闭模式

//HTML

    <div id="simplemodal-container" class="simplemodal-container" style="background-color: rgb(255, 255, 255); border-color: rgb(255, 255, 255); height: 297px; padding: 0px; width: 984px; position: fixed; z-index: 1002; left: 138.5px; top: 75.5px;">
        <a class="modalCloseImg simplemodal-close" title="Close"></a>
        <div class="simplemodal-wrap" tabindex="-1" style="height: 100%; outline: 0px none; width: 100%; overflow: visible;">
            <div id="simplemodal-data" class="simplemodal-data" style="">
                <div class="modal_info tariff_T010129">
                    <img class="table_image" width="974" height="287" longdesc="http://www.three.ie/products_services/priceplans/billpay/index.html" alt="Flexifix tariff info" src="https://www.three.ie/imgs/shop/tariff_info/flexifix-tariff-table.jpg" style="">
                </div>
            </div>
        </div>
</div>

也许最简单的方法就是使用它,因为您已经找到了这个元素的相关
CSS

driver.findElement(By.cssSelector("a.modalCloseImg")).click();
(这在
Java
中,但我相信您可以修改
C

driver.findElement(By.cssSelector("a.modalCloseImg")).click();