chrome automation extension崩溃(selenium +chromedriver)

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox");//划重点,加上这句,就不会报崩溃了,当然也可能是chromedriver和chrome的版本匹配问题
# 无头模式启动
if is_headless:
    chrome_options.add_argument('--headless')
# chrome_options.add_argument("--start-maximized")
# 谷歌文档提到需要加上这个属性来规避bug
chrome_options.add_argument('--disable-gpu')

# 设置屏幕器宽高
# chrome_options.add_argument("--window-size=1440,750");
driver=webdriver.Chrome(chrome_options=chrome_options)

chromedriver下载地址:http://npm.taobao.org/mirrors/chromedriver/

版本匹配,使用方法自行百度

----------ChromeDriver v2.45 (2018-12-10)----------
Supports Chrome v70-72


----------ChromeDriver v2.44 (2018-11-19)----------
Supports Chrome v69-71


----------ChromeDriver v2.43 (2018-10-16)----------
Supports Chrome v69-71


----------ChromeDriver v2.42 (2018-09-13)----------
Supports Chrome v68-70


----------ChromeDriver v2.41 (2018-07-27)----------
Supports Chrome v67-69


----------ChromeDriver v2.40 (2018-06-07)----------
Supports Chrome v66-68


----------ChromeDriver v2.39 (2018-05-30)----------
Supports Chrome v66-68


----------ChromeDriver v2.38 (2018-04-17)----------
Supports Chrome v65-67

----------ChromeDriver v2.37 (2018-03-16)----------
Supports Chrome v64-66

----------ChromeDriver v2.36 (2018-03-02)----------
Supports Chrome v63-65


----------ChromeDriver v2.35 (2018-01-10)----------
Supports Chrome v62-64

----------ChromeDriver v2.34 (2017-12-10)----------
Supports Chrome v61-63
Resolved issue 2025: Incorrect navigation on Chrome v63+ [['Pri-0']]
Resolved issue 2034: Error looking for "Timeline.start" in Chrome [['Pri-2']]
Resolved issue 1883: Unable to emulate android devices with Chromedriver 2.30 [['Pri-2']]
Resolved issue 2103: Touch in mobile emulation doesn't work [[]]

----------ChromeDriver v2.33 (2017-10-03)----------
Supports Chrome v60-62
Resolved issue 2032: ChromeDriver crashes while creating DNS resolver [['Pri-1']]
Resolved issue 1918: Get/SetWindowSize & Get/SetWindowPosition commands are failing on Chromev62+ [['Pri-1']]
Resolved issue 2013: Android 8.0.0 webviews not supported [['Pri-2']]
Resolved issue 2017: In mobileEmulation "element is not clickable" if it is outside the visible area [['Pri-2']]
Resolved issue 1981: chromedriver does not respect excludeSwitches flag [['Pri-2']]
Partially Resolved issue 2002: Add Cookie is not spec compliant [[]]
Resolved issue 1985: FindElement raises the wrong error [[]]

----------ChromeDriver v2.32 (2017-08-30)----------
Supports Chrome v59-61
Resolved issue 1852: Error 'Element is not clickable at point' occurs on Chrome v61+ [['Pri-1']]
Resolved issue 1950: DeleteCookie in Chrome v62 and Chromedriver v2.31 fails [['Pri-2']]
Resolved issue 1942: ChromeDriver response in W3C mode is not standard compliant [['Pri-2']]
Resolved issue 1910: Fails to retrieve default prompt text on Chrome v62+ [['Pri-2']]
Resolved issue 1900: LaunchApp command throws UnknownError: cannot get automation extension on Mac and Windows Chrome v62+ [['Pri-2']]
Resolved issue 1885: unknown error: Cannot use 'in' operator to search for 'String' in null [['Pri-2']]
Resolved issue 1882: Chromedriver URI for Execute Async Script is not spec compliant [['Pri-3']]
Resolved issue 1621: Implement session/<session id>/window/fullscreen command [['Pri-3']]
Resolved issue 1896: Characters '3' and '#' are not being entered using SendKeys on Mac Chrome v62+ [[]]
Resolved issue 1894: chromedriver 2.31 should be linked with glibc 2.17 [[]]
Resolved issue 1740: ChromeDriver session handshake needs to be W3C compliant [[]]
Resolved issue 1898: Wrong error is thrown while sending text to non prompt dialog. [[]]
Resolved issue 1888: Chromedriver doesn't throw an exception when uploading an invalid file with selenium [[]]

----------ChromeDriver v2.31 (2017-07-21)----------
Supports Chrome v58-60
Resolved issue 1804: Flakiness when retrieving cookies using GetCookies command on Windows [['Pri-1']]
Resolved issue 1879: Implement /session/{session id}/cookie/{name} command [['Pri-2']]
Resolved issue 1860: WebDriverException: Message: unknown error: bad inspector message:"" when attempting to get page_source [['Pri-2']]
Resolved issue 1293: Timed out receiving message from renderer on window.location change [['Pri-2']]
Resolved issue 1849: ChromeDriver 2.30 AddCookie command uses incorrect default path [['Pri-2']]
Resolved issue 1256: switchToFrame should throw StaleElementReferenceException in case the element is stale [['Pri-2']]
Resolved issue 1786: Feature request: change chromeOptions to goog:chromeOptions [['Pri-3']]
Resolved issue 1772: Chromedriver running against canary chrome w/ headless flag requires XVFB for sendKey interactions [[]]
Resolved issue 727979: Failed to set Chrome's command line file on device for long command line [['Pri-3']]

----------ChromeDriver v2.30 (2017-06-07)----------
Supports Chrome v58-60
Resolved issue 644: ChromeDriver does not delete the profile & scoped_dir* folders after test exits [['Pri-1']]
Resolved issue 1114: unknown error:Maximum call stack size exceeded on calling any webdriver command [['OS-All', 'Pri-1']]
Resolved issue 1773: ChromeDriver crashes when using console.time on Chromev58+ [['OS-All', 'Pri-1']]
Resolved issue 1526: mobileEmulation not working for the listed devices in the chrome [['Pri-2']]
Resolved issue 1777: NoSuchFrameException is thrown when attempting to focus on a frame with protocol "chrome-extension://" within a page with protocol "https://" on Chrome 58 [['OS-All', 'Pri-2']]
Resolved issue 1779: testWindowMaximize is failing on Mac for Chrome v60+ [['OS-Mac', 'Pri-2']]
Resolved issue 1775: testShouldHandleNewWindowLoadingProperly failing on Chrome v60+ [['OS-All', 'Pri-2']]
Resolved issue 1796: Chromedriver failed to connect to Chrome on CrOS with latest canary build [[]]
Resolved issue 1353: Sending text to Alert / Confirm dialog should throw element not visible exception [[]]

----------ChromeDriver v2.29 (2017-04-04)----------
Supports Chrome v56-58
Resolved issue 1521: Assignment to Object.prototype.$family causes a crash [['Pri-1']]
Resolved issue 1482: Chromedriver cannot handle the alert generated by onbeforeunload event [['OS-All', 'Pri-2']]
Resolved issue 1315: |switch_to.window| does not visually switch tabs [['OS-All', 'Pri-3']]

----------ChromeDriver v2.28 (2017-03-09)----------
Supports Chrome v55-57
Resolved issue 1625: Error: cannot get automation extension on Chrome57+ [['OS-All', 'Pri-1', 'merge-merged-2987']]
Resolved issue 1695: Chrome crashes on Linux32 bot [['OS-Linux', 'Pri-1']]
Resolved issue 1467: A hang occurs when an alert dialog is displayed on Chrome 52+ [['OS-All', 'Pri-2']]
Resolved issue 1688: Exported Netlog with --log-net-log is truncated [['OS-Linux', 'OS-Mac', 'Pri-2']]
Resolved issue 1388: find Elements is failing [['Pri-2']]

----------ChromeDriver v2.27 (2016-12-23)----------
Supports Chrome v54-56
Resolved issue 1637: Getting window handles fails in the presence of shared workers on Chrome 55+ [['OS-All', 'Pri-1']]

----------ChromeDriver v2.26 (2016-12-09)----------
Supports Chrome v53-55
Resolved issue 1607: Chrome 57+ with perf logs enabled fails with "unexpected command response" [['OS-All', 'Pri-1']]
Resolved issue 1502: sendKeys(): SPACE key does not work on Chrome 53 [['OS-All', 'Pri-1']]
Resolved issue 984: Extend ChromeDriver capabilities to cover network throttling feature from Chrome DevTools [['OS-All', 'Pri-2']]
Resolved issue 877: UnhandledAlertException not being propagated upwards [['OS-All', 'Pri-2']]
Resolved issue 1578: Flash plugin blocked after updating Chrome browser [['OS-All', 'Pri-2']]
Resolved issue 1617: Fullscreen command is not recognised [['OS-All', 'Pri-3']]
Resolved issue 839: clear does not work on input type number with string value [['Pri-3']]
Resolved issue 1500: "Could not handle JavaScript dialog" error occurs randomly when accepting confirmation dialogs. [[]]
Resolved issue 1541: find element with empty tag is raising wrong exception in findElement [[]]
Resolved issue 1540: empty tagname value should raise an error when doing findElements [[]]

----------ChromeDriver v2.25 (2016-10-25)----------
Supports Chrome v53-55
Resolved issue 1547: Chromedriver crashes during event Runtime.consoleAPICalled [['OS-All', 'Pri-1']]
Resolved issue 1514: GetLog command times out if an alert is showing [['OS-All', 'Pri-1']]
Resolved issue 1460: "Disable Developer Mode Extensions" exists on Mac, but not Windows [[]]

----------ChromeDriver v2.24 (2016-09-09)----------
Supports Chrome v52-54
Resolved issue 1497: GetLog fails when the current window is closed [['OS-All', 'Pri-0']]
Resolved issue 1495: ChromeDriver crashes with "Check failed: !page_load_strategy_.empty()" [['OS-All', 'Pri-0']]
Resolved issue 1463: SessionNotCreatedException: Runtime.evaluate missing 'wasThrown' on Chrome 54+ [['OS-All', 'Pri-0']]
Resolved issue 1484: SendKeys of a Tab Key has no effect in Chrome 53 [['OS-All', 'Pri-1']]
Resolved issue 1431: GetLog command does not work for Chrome 54+ [['OS-All', 'Pri-1']]
Resolved issue 1411: sendKeys generates events that are missing some fields [['OS-All', 'Pri-1']]
Resolved issue 1451: Chrome 54+ session not created exception: Runtime.executionContextCreated has invalid 'context' [['Pri-1']]
Resolved issue 984: Extend ChromeDriver capabilities to cover network throttling feature from Chrome DevTools [['OS-All', 'Pri-2']]
Resolved issue 1454: Net::ReadTimeout error on launching Canary v54 through RemoteWebDriver [[]]

----------ChromeDriver v2.23 (2016-08-04)----------
Supports Chrome v51-53
Resolved issue 1378: Android 6: Intitialization of Chrome driver fails when Chrome/Webview process is in running (R) state [['OS-Android', 'Pri-1']]
Resolved issue 1379: Chromedriver does not catch all available browser console log entries [['OS-All', 'Pri-2']]

----------ChromeDriver v2.22 (2016-06-06)----------
Supports Chrome v49-52
Resolved issue 1348: Timeout error while navigating to URL on Chrome 51+ [['OS-All', 'Pri-0']]
Resolved issue 1381: Timeout error occurs when alert dialog is displayed on Chrome 52+ [['OS-All', 'Pri-1', 'merge-merged-2743']]
Resolved issue 1339: Failure when executing JS in a content script context [['OS-All', 'Pri-1']]
Resolved issue 1387: ChromeDriver hangs when calling driver.get() for same-process navigations [['OS-All', 'Pri-1']]
Resolved issue 1365: Touch emulation is not working under mobile emulation in Chrome 50+ [['OS-All', 'Pri-1']]
Resolved issue 1224: Chrome WebDriver throws an exception when trying to click a button inside a frame  [['OS-All', 'Pri-2']]
Resolved issue 107: ChromeDriver Won't Switch To Frame inside nested frameset [['OS-All', 'Pri-2']]
Resolved issue 1368: ExecuteScript returns "Cannot read property 'document' of null" [[]]
Resolved issue 1355: Session not created exception when connecting to existing browser on localhost [[]]
Resolved issue 1331: "chromeOptions.excludeSwitches" is not working on Android [[]]

----------ChromeDriver v2.21 (2016-01-28)----------
Supports Chrome v46-50
Resolved issue 1276: empty FindElement response is returned while trying to find element with tagname object/embed [['OS-All', 'Pri-1']]
Resolved issue 1272: GET url returns "data:text/html,chromewebdata" [['OS-All', 'Pri-2']]
Resolved issue 1310: ChromeDriver hangs (and times out) when inspecting inactive background pages [['OS-All', 'Pri-2']]
Resolved issue 824: ChromeDriver creates two cookies when the cookie to add contains the domain [['OS-All', 'Pri-2']]
Resolved issue 1274: ExecuteScript sends script to wrong execution context [['OS-All', 'Pri-2']]
Resolved issue 1249: Change "get current URL" behavior in ChromeDriver [['OS-All', 'Pri-2']]
Resolved issue 904: include Alert text in UnhandledAlertError stack trace [['OS-All', 'Pri-2']]
Resolved issue 474: getAttribute() fails when attribute name has colon (:) character [['OS-All', 'Pri-3']]
Resolved issue 1245: Unable to switch to 1st opened window in session [[]]
Resolved issue 1290: Cannot access elements from subframes [[]]
Resolved issue 1261: getTitle() should return empty string instead of page url when page title is empty [[]]
Resolved issue 1238: testExecuteInRemovedFrame fails on waterfall bots [['OS-All']]
Resolved issue 1246: Chromedriver version number is not displayed in logs/ getCapabilities() [['OS-All']]

----------ChromeDriver v2.20 (2015-10-08)----------
Supports Chrome v43-48
Resolved issue 1225: RESPONSE InitSession unknown error: Device <device_id> is not online [['OS-Android', 'Pri-0']]
Resolved issue 960: ChromeDriver support to access WebView elements [['OS-All', 'Pri-2']]
Resolved issue 1229: Spec violation: /sessions endpoint returns session ID at `sessionId` key instead of `id` key [['OS-All', 'Pri-2']]

----------ChromeDriver v2.19 (2015-08-28)----------
Supports Chrome v43-47
Resolved issue 1167: Various issues with ChromeDriver navigation tracker [['OS-All', 'Pri-1']]
Resolved issue 1205: Chrome crashes when enabling touch emulation [['OS-Mac', 'OS-Windows', 'Pri-1']]
Resolved issue 1142: cookies' httponly attribute is not returned [['Pri-2']]

----------ChromeDriver v2.18 (2015-08-19)----------
Supports Chrome v43-46
Resolved issue 1158: Unable to find elements after installing Chrome 44 [['ChromeDriver-2.17', 'OS-All', 'Pri-1']]
Resolved issue 635: Implement touch actions for android chrome [['OS-Android', 'Pri-2']]
Resolved issue 1194: unknown error: cannot determine loading status from disconnected: received Inspector.detached event [[]]
Selenium是一个用于Web应用程序测试的自动化工具。它允许你编写脚本来模拟用户的行为,如点击、输入、导航等。结合ChromeDriverSelenium可以控制Chrome浏览器的各种操作,包括模拟键盘快捷键操作。 在Selenium中模拟CTRL+F查找操作通常分为以下步骤: 1. 打开目标网页。 2. 等待页面加载完成。 3. 触发CTRL+F快捷键查找操作。 4. 输入查找内容并获取搜索结果。 以下是一个使用Python语言和Selenium实现CTRL+F查找操作的代码示例: ```python from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains # 启动Chrome浏览器 driver = webdriver.Chrome() # 打开目标网页 driver.get("http://example.com") # 等待页面加载完成 driver.implicitly_wait(10) # 触发CTRL+F快捷键 # 首先需要定位到浏览器中的搜索框,通常是页面的一个可编辑元素 # 然后使用ActionChains类模拟按键操作 search_box = driver.find_element_by_name('q') # 这里的'name'属性根据实际页面搜索框的name属性值来定位 ActionChains(driver).key_down(Keys.CONTROL).send_keys('f').key_up(Keys.CONTROL).perform() # 输入查找内容 search_box.send_keys('需要查找的文本') # 如果需要进一步操作搜索结果,可能需要编写额外的逻辑代码 ``` 请注意,上述代码只是一个基础示例,实际使用时需要根据目标网站的具体情况来调整代码中的元素定位和逻辑。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值