简体   繁体   English

C#Selenium Element单击找不到具有相同类名的后续子元素。 我做错了什么?

[英]C# Selenium Element Click can't find subsequent sub elements with same classname. What am I doing incorrect?

Given 给定

When page first loads and this statement is run : 当页面首次加载并运行此语句时:

webdriver.FindElements(By.ClassName("TreeNode");

I can easily find all those elements, but after clicking on one of them to get to the sublements, that same query doesn't show the new elements even though they are all using the same class. 我可以轻松找到所有这些元素,但是在单击其中一个元素以进入子元素之后,即使它们都使用相同的类,相同的查询也不会显示新元素。

How do I get Selenium to cough up the new elements? 我如何让硒咳出新元素?

I found that the test program was not waiting long enough after the click. 我发现单击后测试程序没有等待足够长的时间。 I added an arbitrary wait and then all of the elements showed up. 我添加了一个任意的等待,然后显示了所有元素。 Apparently, the test was moving much faster than the browser was. 显然,测试的运行速度比浏览器快得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM