【发布时间】:2018-04-27 20:00:28
【问题描述】:
我正在尝试点击网页上的标签(区域监管):https://www5.fdic.gov/idasp/advSearchLanding.asp
但是,它无法识别该命令。在这里,我附上了代码。
import urllib2
import urllib
from bs4 import BeautifulSoup
import subprocess
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
browser = webdriver.Chrome("/usr/local/bin/chromedriver")
import time
s1_url = 'https://www5.fdic.gov/idasp/advSearchLanding.asp'
browser.get(s1_url)
问题:选择监管区域选项卡但没有点击它。
browser.find_element_by_xpath('//[@id="Banks_Regulatory_Tab"]/a').click()
遇到异常:
NoSuchElementException:消息:没有这样的元素:无法找到元素:{"method":"xpath","selector":"//*[@id="Banks_Regulatory_Tab"]/a"}
【问题讨论】:
标签: python-2.7 selenium-webdriver xpath web-scraping nosuchelementexception