Cannot find WebDriverWait class in OpenQA.Selenium (C#)

前端 未结 3 1714
感情败类
感情败类 2020-12-14 07:07

(Migrating from Java-Selenium to C#-Selenium)

When searching for explicit waits with Selenium and C# I find several posts with code that looks simil

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 07:38

    Have you tried adding?

    using OpenQA.Selenium.Support.UI;
    

    That should be all you need. Depending on your IDE, it likely (?) will have a helper that will find and add missing references. I use Visual Studio. I just type what I know should be there. When the IDE puts red squiggles on WebDriverWait, I hover over it and it shows a tooltip that says I'm missing a reference and I click on the link, Show potential fixes. In the new tooltip it shows several options, usually the first of which is to add the using statement. I click that one and the red squiggles go away.

    I really like Visual Studio but I've been using Eclipse for the last 9 months or so and I prefer the way Eclipse handles this. I think it's more intuitive... but that's just me.


    EDIT

    Just wanted to make clear for future readers... I don't use NuGet. I just download the Selenium .Net package and drop the 4 DLLs in/near my project and then add references to all 4 of them to my Visual Studio project. Once I do that and use the instructions above, it works for me.

提交回复
热议问题