忽略葡萄牙语的评论
from selenium import webdriver
from time import sleep
from bs4 import BeautifulSoup
from selenium.webdriver.common.by import By
driver=webdriver.Chrome('C:/Users/LENOVO/Desktop/WEB SCRAPPING/Selenium/chromedriver.exe')#padrão
driver.get('https://stackoverflow.com/questions/726
嗨,我有下面的脚本,提取每个网站的名称和地址,但我希望也能够提取每个网站的href,以便我链接到各个网站。有什么建议吗?
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import Chrome
我需要使用Selenium从页面中提取一些信息,这些元素不在页面代码中(似乎是JavaScript)。我就是这么做的:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditi
我尝试编写xpath表达式,这样我的测试就不会因小的设计更改而中断。因此,与Selenium IDE生成的表达式不同,我编写了自己的表达式。
这里有一个问题:
//input[@name='question'][7]
这个表达式根本不起作用。名为“问题”的输入节点分布在整个页面上。他们不是兄弟姐妹。
我试过使用中间表达式,但也失败了。
(//input[@name='question'])[2]
error = Error: Element (//input[@name='question'])[2] not found
这就是为什么我认为Sel
我使用带有selenium的JavaScript来自动生成一个网页,该网页上有我需要点击的几个按钮。我的代码从连接到现有的铬窗口开始,如下所示:
var chrome = require("selenium-webdriver/chrome");
var options = new chrome.Options();
options.options_["debuggerAddress"] = "127.0.0.1:9222";
var driver = new webdriver.Builder()
.fo
你好,我正在尝试提取主表中每个行元素的日期。date元素位于一个名为的标记中:
<td style="display: none;">
下面是我的脚本:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.
我想要计算具有特定背景颜色的字符的数量。为了认识到我使用这个解决方案遍历了所有的HTML节点:
Html页面:
<span style="background-color: #ffff00;">
<span id="child">I inherit the background color but Selenium gives me back transparent</span>
</span>
Selenium示例:
FirefoxDriver firefoxDriver = new Firefo
我有一个复杂的DOM结构,其HTML id属性值是动态变化的。当我尝试提取“自定义”属性的值时,Selenium返回"null“。
我需要提取parentId的值(即我需要"qqq-bbb",每次重新加载都不同)
//Selenium(C#):
// evaluates to "null"
string someStringName = someIWebElement.GetAttribute("parentId");
//HTML tag (example):
// in Chrome the parentId is