vb.net - 从 HTML 源代码中查找 HTML 元素
问题描述
所以我试图找到一个 HTML 元素,它是:
<a class="signout" href="https://www.dreamstime.com/logout.php">Sign out</a>
我的代码是:
Dim thepage As String = postreqreader.ReadToEnd
If thepage.Contains("<a href="https: //www.dreamstime.com/logout.php" class="signout">Sign out</a>") Then
good += 1
Label2.Text = "Good: " & good.ToString
If pencil = False Then
TextBox1.Text += currentaccount & vbNewLine
Me.Refresh()
End If
但是每次都会出现这个错误: OPEN ME
我尝试删除空格,但它一直出现错误说逗号,“)”,或预期的有效表达式延续。
解决方案
您没有正确地转义引号。"A" = A, "" = , """" = "
或者让使用 * 以便更容易看到,*"**,首先 * 表示开始,然后 " 你的字符,然后是另一个 *,所以它知道字符结束,并且 * 作为字符串的结尾。
在较长的字符串中,看起来像:
"some string ""is"" here"
这导致:
some string "is" here
推荐阅读
- python - 从嵌套字典中获取此值的更简洁方法?
- acumatica - 尝试创建新行时获取重复的 Cache.Inserted 记录
- sql - 在 Spark 上更新 Oracle 表时如何避免 ORA-00060(检测到死锁)错误
- java - 在命令行上转义 Maven 属性
- react-native - 用玩笑测试 expo 应用程序,但由于实验性语法测试崩溃
- javascript - SyntaxError:Node.js 中 Module._compile 的输入意外结束
- python - Django1.2/google-appengine 调试“KeyError:'REQUEST_METHOD”错误
- python - Seaborn 密度图隐藏散点图
- swift - 如何通过重复较短的序列压缩 observables
- java - 访问类型为 java.util.ArrayList 的 json 中的所有键