[极简]Mac selenium chromedriver

280 阅读1分钟

遇到问题:无法打开“xxx”,因为无法验证开发者。macos无法验证此 App 是否包含恶意软件。

找到chromedriver存在的目录 使用# 扩展文件属性#

//来查看隔离扩展属性具体信息
xattr -p com.apple.quarantine ${file}
//删除给定的属性(当前执行)
xattr -d com.apple.quarantine ${file}

拓展

-c CLear all Atrributes.
-d Delete the given attribute.
-h Help.
-l By default, the first two command forms either display just the attribute names or
values, respectively. The -l option causes both the attribute names and corresponding
values to be displayed. For hex display of values, the output is preceeded with the hex
offset values and followed by ASCII display, enclosed by ‘|’.
-p Print the value associated with the given attribute.
-r If a file argument is a directory, act as if the entire contents of the directory
recursively were also specified (so that every file in the directory tree is acted upon).
-s If a file argument is a symbolic link, act on the symbolic link itself, rather than
the file that the symbolic link points at.
-v Force the the file name to be displayed, even for a single file.
-w Write a given attribute name with a value.
-x Force the attribute value to be displayed in the hexadecimal representation.

可能问题:版本问题

chromedriver的选择要与当前电脑上的chrome版本对应,Chrome73以上版本,ChromeDriver版本与Chrome版本均保持一致;Chrome73以下版本,可参考以下关系表,查找ChromeDriver版本。

image.png

正常情况下,应该去这个里面去找: chromedriver.storage.googleapis.com/index.html 但只到114,虽然能用到115上,但是会有警告。

116版本:googlechromelabs.github.io/chrome-for-…