在你点击create an account之后,我正在努力定位facebook.com上的名字框。id会随着每次刷新而改变,所以我很难找到它。id总是u_somenumber_b。例如id = u_1_b,u_2_b等。下面是我到目前为止所得到的:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expec
我正试图遍历一个包含公司列表的目录。我用selenium编写了这段代码,它只打开一个链接。我想打开一个新标签中的每个链接,并刮一些信息。
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
browser = webdriver.Firefox() # Get local session of firefox
# 0 wait until the pages a
快速概述:我正在编写一个非常简单的脚本,使用Python和Selenium来查看多个Facebook页面的Facebook。
我正试图找到一种干净的方法来遍历页面并输出结果(这只是我正在收集的一个数字)。
这是我现在所拥有的,但它不起作用。
# Navigate to metrics page
pages = ["page_example_1", "page_example_2", "page_example_3"]
for link in pages:
browser.get(('https://www.facebook.c
当我试图从这个的网页元素中获取一些文本时。我正在尝试获取公司名称/电子邮件等信息。我编写的代码如下所示。每次我执行这段代码时。它给了我一个错误。
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
from lxml import html
import requests
import xlwt
import urllib
import re
我使用Selenium自动在wappalyzer.com上进行搜索。下面是我的代码:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
def handleWappalyzer(driver):
driver.find_element(By.CSS_SELECTOR, "
我想
激活打开的窗口,假设fb.com添加一个带有URL的新选项卡,比如google.com
看起来很直截了当,但我在挣扎.
您能告诉我如何使用Selenium来编写python代码吗?(我是WIndow 10用户,顺便说一下)
下面的代码是我到目前为止得到的
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebD
<input name="email" id="email" type="text" class="form-control" value="example@gmail.com" readonly="">
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import re
import pandas as pd
i
昨天我编写了这段代码,通过whatsapp发送消息。但是,我尝试了许多方法来将消息放入消息框中,但似乎都不起作用。每次我得到错误:消息:未知错误:调用函数结果缺少'value‘。我尝试了所有的xpath(类)来插入消息,所以我认为有些地方出了问题。在运行代码时,它会打开web.whatsapp,选择合适的人,选择消息框,但不会将消息放入其中。或者可能是我的驱动程序和chrome的版本不一致?
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from seleni
我正在用Java编写一个测试用例,并使用selenium记录一组事件,并将它们“重放”到应用程序中。守则是:
// *The app opens a new window*
// Get handle of the main window
String mainWindowHnd = webDriver.getWindowHandle();
// Get all open window handlers
Set openWindows = webDriver.getWindowHandles();
Iterator ite=openWi
我有家庭作业要在python中用Selenium编写一个程序,在hotmail上发送电子邮件。一切都很好,直到我不得不找到“新消息”按钮(或者说诚实地说,页面上的任何其他按钮),我总是得到selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element:。
我试过了:Class,Xpath,FullXpath,Css Selector。无法使用检查器找到名称或Id。
我试着让它和time.sleep一起等待
我真的不知道该怎么办。我的密码在这
我正在使用flex仪表板工具来创建仪表板。仪表板上有几个标签。我想知道如何将颜色应用到标签的标题/名称/标签上。谢谢!
以下是守则:
---
title: "A Template of Dashboard with Pages and Tabs"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
social: [ "twitter", "facebook", "menu" ]
---
我正在尝试发送一些快捷键,以便使用python中的selenium在chrome中打开一个新的选项卡。我打开facebook,然后登录,然后我想打开一个新的标签,在那里我可以传递我一个朋友的url,这样我就可以查看他的个人资料。我写了以下代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import getpass
driver = webdriver.Chrome()
#opening browser and loging into the account
def logi
我想通过单击Selenium中的download按钮来下载一个简单的csv数据集。感兴趣的按钮是大地图下面的“获取数据”按钮。这是我的代码,你可以跟着我。 编辑:这段代码是用Selenium for Python编写的。 import time, os
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.comm
嗨,我是python的新手,并且一直在尝试web抓取。下面是我的代码:
print('What is the term to be searched?')
term = input()
browser = webdriver.Firefox(executable_path ='/usr/local/bin/geckodriver')
browser.get('https://google.com/search?q=' + term)
try:
link = browser.find_element_by_link_text(
我试图从特定的web元素中获取一些信息。问题是,当我尝试获取不需要for循环的信息时,程序工作起来就像一种魅力。但是,当我将其放入for循环并尝试时,它不会检测到循环中的web元素。下面是我一直在尝试的代码:
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
from lxml import html
import requests
impo
我正在尝试提取一个人在Facebook上喜欢的所有页面。因此,我将Python与BeautifulSoup和selenium一起使用来自动化连接。
然而,即使我的代码工作正常,它实际上也不会返回所有结果(例如,在我自己的个人资料中,它只返回所有页面的大约20% )。
我读到它可能是BeautifulSoup中使用的解析器,但我尝试了一大堆解析器(html.parser、lxml...)而且总是一样的事情。会不会是因为Facebook使用AJAX动态生成页面?但是我有Selenium,它应该正确地解释它。下面是我的代码:
from selenium import webdriver
from b