首页 \ 问答 \ 如何在使用C#的Selenium中使用JavaScriptExecutor将style属性设置为div(How to set style property to div using JavaScriptExecutor in selenium using C#)

如何在使用C#的Selenium中使用JavaScriptExecutor将style属性设置为div(How to set style property to div using JavaScriptExecutor in selenium using C#)

我正在尝试使用JavaScriptExecutor使用C#设置div元素的样式。 下面是我尝试过的代码,但没有任何反应

IJavaScriptExecutor js = (IJavaScriptExecutor)driver;  
IWebElement element = driver.FindElement(By.XPath("//div[contains(@class,'rmSlide')]"));
js.ExecuteScript("arguments[0].setAttribute(arguments[1], arguments[2])", 
element, "style", 
"visibility: visible;
height: 259px; 
width: 339px;
display: block;
overflow: hidden;
left: -81px;
top: 24px;
z-index: 2; "
);

我所要做的就是将display: block设置为display: none

以下是元素的Html

在这里输入图像描述


I am trying to set style of a div element using JavascriptExecutor using C#. below is the code i tried but nothing happens

IJavaScriptExecutor js = (IJavaScriptExecutor)driver;  
IWebElement element = driver.FindElement(By.XPath("//div[contains(@class,'rmSlide')]"));
js.ExecuteScript("arguments[0].setAttribute(arguments[1], arguments[2])", 
element, "style", 
"visibility: visible;
height: 259px; 
width: 339px;
display: block;
overflow: hidden;
left: -81px;
top: 24px;
z-index: 2; "
);

All I am trying to do is setting the display: block from display: none

Below is the Html of the element

enter image description here


原文:https://stackoverflow.com/questions/48578091
更新时间:2023-10-08 22:10

最满意答案

您正在寻找

while :
do
    wget -O - -q "http://some.url/" > /dev/null
done

这不会保存文件,也不会输出无用的信息,并在/dev/null反复转储内容

编辑只消耗带宽,使用ping -fping -f -s 65507


you're looking for

while :
do
    wget -O - -q "http://some.url/" > /dev/null
done

this will not save the file, not output useless info, and dump the contents over and over again in /dev/null

edit to just consume bandwidth, use ping -f or ping -f -s 65507

相关问答

更多
  • 看看http://www.codeproject.com/KB/IP/MyDownloader.aspx 他使用的是众所周知的技术,可以在Downloader.Extension \ SpeedLimit中找到 基本上,在读取更多数据流之前,会检查自上次迭代以来实际读取了多少数据。 如果该速率超过最大速率,那么读取命令暂停很短的时间,并重复检查。 大多数应用程序使用此技术 Take a look at http://www.codeproject.com/KB/IP/MyDownloader.aspx He ...
  • iperf允许您执行UDP和TCP测试。 在UDP模式下运行iperf时,您可以说明带宽。 这实际上是客户端尝试向服务器泵送的每秒数据量。 某些数据可能安全到达,但某些数据可能会丢失(由于服务器和客户端之间的实际带宽)。 在TCP模式下运行iperf时,仅在您想要限制带宽时才说明带宽(并且您还必须考虑数据包大小,因为由于iperf行为,这限制了最小带宽限制。 )。 实际带宽由TCP窗口大小和连接延迟确定 。 有关TCP窗口和吞吐量的更多信息,请参见此处 。 iperf allows you to perfo ...
  • 不会超出明显下载已知大小和时间的文件需要多长时间。 这样做的缺点就是你需要浪费很多带宽才能做到这一点。 此外,如果您想要在吞吐量降至阈值以下时发出警报,则必须连续运行测试。 恕我直言,我会在一些地方表现不佳,因为如果它确实发生,你无法做任何事情。 抱歉。 Not beyond the obvious of downloading a file of a known size and timing how long it takes. the disadvantage of that is that you' ...
  • 没有.CDN和带宽是完全不同的概念。 CDN代表Content Delivery Network,它允许您从距离您的应用程序用户最近的服务器提供Blob存储内容。 有关CDN的更多信息,请访问: http : //en.wikipedia.org/wiki/Content_delivery_network 。 带宽是传输的数据量(通常以字节为单位)。 No. CDN and Bandwidth are entirely different concepts. CDN stands for Content D ...
  • 您正在寻找 while : do wget -O - -q "http://some.url/" > /dev/null done 这不会保存文件,也不会输出无用的信息,并在/dev/null反复转储内容 编辑只消耗带宽,使用ping -f或ping -f -s 65507 you're looking for while : do wget -O - -q "http://some.url/" > /dev/null done this will not save the file, ...
  • 零,除非在套接字上启用TCP KEEPALIVE,在这种情况下它仍然基本上为零。 但是500-600Kb并不是“非常小的包”。 你的意思是500-600 字节? Zero, unless TCP KEEPALIVE is enabled on the socket, in which case it is still essentially zero. But 500-600Kb is not 'very small packets'. Do you mean 500-600 bytes?
  • 然而,存在称为分组对探测的技术。 您将一个接一个地发送到数据包。 从理论上讲,可用带宽越少,到达时间就越多。 There is however a technique called packet pair probing. You send to packets one immediately after the other. In theory, the less bandwidth available, the more they will spread away in arrival time.
  • 你可以将你的内容分解成碎片,关键和非关键。 加载第一个,计时,然后加载第二个,如果满足要求。 我之前做过一个有画外音的游戏。 你可以在没有它们的情况下玩游戏,所以如果我检测到实际游戏的负载较慢,我会提示用户。 然后他们可以选择等待声音,或继续玩。 You could break your content into pieces, the crucial, and the non-crucial. Load the first, time it, and then load the second if the ...
  • 在特定区域内,根本没有转移成本。 您提到过使用App Service,blob和SQL数据库。 只要这些服务位于单个区域内,当它们与该区域内的任何其他服务之间的数据流动时,带宽成本为零。 带宽专门用于出站转移。 所以,基本上你会计算出离开给定区域的所有数据。 Within a given region, there are no transfer costs at all. You mentioned using App Service, blobs, and SQL Database. As long a ...
  • 首先,您的网卡可能是100Mb /秒而不是100MB /秒。 到目前为止,以太网是最常见的有线网络类型,通常每秒10,100,1000兆比特 。 100兆比特/秒的以太网接口大致能够达到每秒12.5兆比特的速度。 如果您已插入以太网交换机 ,则最有可能以全双工模式连接。 这允许两端在不影响彼此性能的情况下同时彼此对话。 你永远无法达到完全宣传的速度,千兆网络接口(1000Mb /秒)通常能够在高速900的每个方向上传输而没有问题。 有一些因素导致开销无法达到全速。 此外,许多低端网卡或计算机都难以达到全速, ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)