- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
HTML
<a onclick="loadYearPage('2018-2019')" style="cursor: pointer;">2018-2019</a>
ie.document.querySelector("[onclick='loadYearPage('2018-2019')']").Click
最佳答案
蒂姆的回答将是我的偏好,因为它很好地逃脱了。您还可以使用不同的运算符指定多个 css 属性 = 值选择器并结合 as 和语法
ie.document.querySelector("a[onclick^=loadYearPage][onclick*='2018-2019']")
ie.document.querySelector("a[onclick*='2018-2019']")
onclick
的值中按部分字符串搜索属性。下面是一个示例,您可以将年份作为变量传递。我已经选择了更短的选择器以获得更快的速度。需要稍微等待元素出现。我使用了定时循环。
Option Explicit
'https://www.nseindia.com/products/content/derivatives/currency/cd_historical_businessGrowth.htm
Public Sub PerformClick()
Dim ie As InternetExplorer, t As Date, ele As Object
Const MAX_WAIT_SEC As Long = 10
Set ie = New InternetExplorer
Dim yearSelection As String
yearSelection = "2018-2019"
With ie
.Visible = True
.Navigate2 "https://www.nseindia.com/products/content/derivatives/currency/cd_historical_businessGrowth.htm"
While .Busy Or .readyState < 4: DoEvents: Wend
t = Timer
Do
On Error Resume Next
Set ele = .document.querySelector("[onclick*='" & yearSelection & "']")
On Error GoTo 0
If Timer - t > MAX_WAIT_SEC Then Exit Do
Loop While ele Is Nothing
If Not ele Is Nothing Then
ele.Click
While .Busy Or .readyState < 4: DoEvents: Wend
End If
'other code
Stop '<==Delete me later
.Quit
End With
End Sub
关于html - QuerySelector 中的单引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54341098/
在线编写 yacc 代码的教程使用单引号表示分号和其他字符: ';' '+' '-' (etc) 但是在使用时: '' 在我将其更改为双引号之前,我遇到了错误: "" 相似地, '>=' '==
MySQL documentation说它应该是\'。然而,scite 和 mysql 都显示 '' 有效。我看到了,它有效。我该怎么办? 最佳答案 您引用的 MySQL 文档实际上比您提到的要多一些
MySQL documentation说它应该是\'。然而,scite 和 mysql 都显示 '' 有效。我看到了,它有效。我该怎么办? 最佳答案 您引用的 MySQL 文档实际上比您提到的要多一些
MySQL documentation说它应该是\'。然而,scite 和 mysql 都显示 '' 有效。我看到了,它有效。我该怎么办? 最佳答案 您引用的 MySQL 文档实际上比您提到的要多一些
MySQL documentation说它应该是\'。然而,scite 和 mysql 都显示 '' 有效。我看到了,它有效。我该怎么办? 最佳答案 您引用的 MySQL 文档实际上比您提到的要多一些
我一直在使用 SED (Bash shell) 转义单引号问题。 我需要做 $cfg['Servers'][$i]['password'] = ''; 进入 $cfg['Servers'][$i]['
需要将'替换为\'但这就是我得到的: >>> s = "It's nice to have an example" >>> s.replace("'", "\\'") "It\\'s nice to
我在处理连接字符串中的 ' 字符时遇到问题。 Entity Framework 抛出异常说: Format of the initialization string does not conform
我遇到了一个非常奇怪的问题,我无法设置 Content-Security-Policy 所需的单引号。我假设我运行的是旧版本的 ingress,它仅在我禁用并重新启用它 (microk8s) 后才得到
插入带有撇号的值的正确 SQL 语法是什么? Insert into Person (First, Last) Values 'Joe', 'O'Brien' 我不断收到错误,因为我认为
我有三列数据 selector label option list time you personally
我使用 Java Pattern 类将正则表达式指定为字符串。 举个例子我喜欢成为蜘蛛侠:“彼得·帕克” 应将蜘蛛侠和“Peter Parker”列为单独的标记。谢谢 try { Buffe
我正在尝试删除标记 ' (单引号)但我不知道如何。 我在做delm \'但它不起作用。我也尝试了我能想到的所有组合。 我意识到这更像是一个 Vim 脚本问题,但我在任何地方都找不到。 最佳答案 为什么
如何禁用红色突出显示的特定实例。 我尝试在单引号前输入转义符,但没有成功。我确信单引号导致了红色突出显示,因为当我删除它时,它就会消失。 代码如下: import React from 'react'
我需要输出单引号 (')。它必须是单引号而不是 ',因为这是用于向 jquery 函数提供数据的字符串的一部分。 我使用 C# 循环遍历一个对象来构建一个字符串 "var data = [['Item
我正在尝试: "l'ape"); ?> var my_javascript_object = jQuery.parseJSON(''); 我收到此错误“未捕获的语法错误:意外的标识符”。问题是
我的问题是关于传递给方法验证的“add\”反斜杠单引号,该反斜杠单代码有什么用? document.writeln('\',\'N\'))>'); 最佳答案 欢迎来到堆栈溢出。 反斜杠告诉代码这不是引
我要执行命令: xcodebuild -exportArchive -exportFormat IPA -archivePath myApp.xcarchive -exportPath myApp.i
我有一个字符串,里面有一个 ': example link text 不幸的是,这似乎不起作用。 Firebug 提示“SyntaxError:参数列表后缺少 )”,您可以看到 HTML 实体已被 '
据我所知,'mars%22%3A%22' 和 "mars%22%3A%22" 是等效的,因为没有任何内容被转义. 我创建 javscript 书签已经有一段时间了。有一次,当按原样粘贴到 Chrome
我是一名优秀的程序员,十分优秀!