蓝牙:bluetooth_adapter_winrt.cc 获取默认适配器失败

Bluetooth: bluetooth_adapter_winrt.cc Getting Default Adapter failed

提问人:Vincent 提问时间:5/17/2020 更新时间:11/25/2022 访问量:6653

问:

我正在尝试学习如何使用硒和python,我想抓取这个网站
的新闻标题和新闻日期,但我有一个我不知道如何解决的问题。

这是我的代码:

from selenium import webdriver
from bs4 import BeautifulSoup
import pandas as pd  
import time
import json
driver = webdriver.Chrome("./chromedriver")
driver.implicitly_wait(10)
driver.get("https://www.thestandnews.com/search/?q=%E6%96%B0%E5%86%A0%E8%82%BA%E7%82%8E")
soup = BeautifulSoup(driver.page_source, "lxml")
pages_remaining = True
page_num = 1

My_array = []
while pages_remaining:
 print("Page Number:", page_num)

 soup = BeautifulSoup(driver.page_source, "lxml")
""" #undoned

 tags_lis = soup.find_all("li")
 for tag in tags_lis:
    tag_a = tag.find("a")
    tag_span = tag.find("span")
    title = tag_a.text
    date = tag_span.text
    temp = {"title": title , "date": date}
    print(temp)
    My_array.append(temp)
   """
  try:
    #Press button of next page
    #next_link =driver.find_element_by_xpath()
    nextPg = '//*[@id="___gcse_1"]/div/div/div/div[5]/div[2]/div/div/div[2]/div/div[%d]' % (page_num + 1)
    print(nextPg)
    next_link = driver.find_element_by_xpath(nextPg)
    next_link.click()

    time.sleep(5)
    if page_num < 10:
        page_num = page_num + 1
    else:
        pages_remaining = False
  except Exception:
    pages_remaining = False 
driver.close() 

这是错误消息,任何人都可以给出提示,谢谢!

DevTools listening on ws://127.0.0.1:49952/devtools/browser/749fcb19-d13a-4f38-9d7c-3da58726e10a
[13744:13732:0517/214816.873:ERROR:browser_switcher_service.cc(238)] XXX Init()
Page Number: 1
//*[@id="___gcse_1"]/div/div/div/div[5]/div[2]/div/div/div[2]/div/div[2]
[13744:13732:0517/214824.321:ERROR:device_event_log_impl.cc(162)] [21:48:24.321] Bluetooth: 
bluetooth_adapter_winrt.cc:1055 Getting Default Adapter failed.
Page Number: 2
//*[@id="___gcse_1"]/div/div/div/div[5]/div[2]/div/div/div[2]/div/div[3]
蟒蛇

评论

0赞 Danilo Toro 11/26/2020
我有类似的问题,你找到任何解决方案了吗?-- 我---蓝牙的问题:bluetooth_adapter_winrt.cc:713 GetBluetoothAdapterStaticsActivationFactory 失败:类未注册 (0x80040154)
0赞 A.Raouf 11/30/2020
我用的是firefox
0赞 Vova 4/7/2021
您是否尝试过其他浏览器?或者webdriver-manager软件包会自动安装chromedriver?
1赞 Akzy 6/23/2022
为时已晚,但答案就在这里[stackoverflow.com/a/72507597/11863448]
0赞 Akzy 6/23/2022
@Vincent - 如果您认为对您和他人有帮助,请投赞成票。

答: 暂无答案