xattr question

➜  ~ which chromedriver
/usr/local/bin/chromedriver



xattr -d com.apple.quarantine /usr/local/bin/chromedriver


This is the reason why im asking the question


/Users/mikecallahan/PycharmProjects/scrappingTutorial/venv/bin/python /Users/mikecallahan/PycharmProjects/scrappingTutorial/scrap.py 
Traceback (most recent call last):
  File "/Users/mikecallahan/PycharmProjects/scrappingTutorial/scrap.py", line 5, in <module>
    driver = webdriver.Chrome()
  File "/Users/mikecallahan/PycharmProjects/scrappingTutorial/venv/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    service_log_path, service, keep_alive)
  File "/Users/mikecallahan/PycharmProjects/scrappingTutorial/venv/lib/python3.7/site-packages/selenium/webdriver/chromium/webdriver.py", line 90, in __init__
    self.service.start()
  File "/Users/mikecallahan/PycharmProjects/scrappingTutorial/venv/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 105, in start
    raise WebDriverException("Can not connect to the Service %s" % self.path)
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedriver


Process finished with exit code 1



and this is the code

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get("http://www.python.org")

assert "Python" in driver.title
elem = driver.find_element(By.NAME, "q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)

assert "No results found." not in driver.page_source

driver.close()


It ran one time but then stopped and I researched the issue im having and came up with that. Can someone more knowledgeable on this specific issue fill me in a little more before I just do this?


Posted on Oct 28, 2023 11:42 AM

Reply
Question marked as Best reply

Posted on Oct 28, 2023 7:04 PM

There is no need to worry about security risks. As long as you are sure this software is safe, that xattr command is harmless.


However, just because it is harmless doesn’t mean it will work. Homebrew is well-known for breaking things that are easy and work fine when not using Homebrew. The problem you are having is pretty typical for Homebrew. You don’t know how this software works or how to install it, so you used Homebrew. But then it doesn’t work. So you find what someone on the internet says is a solution, so you try that.


Kudos to you for asking first. In many cases, those internet suggestions can be catastrophic. This one appears to be safe. It might even work. But if it doesn’t work, then I’m afraid you’re in your own. Homebrew doesn’t have any support, so people come here when it fails, as it so often does. But I would never touch it. Maybe someone else will come along.


Usually there are easier ways to scrape data. This kind of setup would only be necessary if you were trying to scrape data that was created only in JavaScript. That’s really pretty rare. And even then, you could probably use Safari’s web inspector to find the internal Ajax calls and grab the json data directly, where it will be much easier to use.

Similar questions

9 replies
Question marked as Best reply

Oct 28, 2023 7:04 PM in response to lac_ekim

There is no need to worry about security risks. As long as you are sure this software is safe, that xattr command is harmless.


However, just because it is harmless doesn’t mean it will work. Homebrew is well-known for breaking things that are easy and work fine when not using Homebrew. The problem you are having is pretty typical for Homebrew. You don’t know how this software works or how to install it, so you used Homebrew. But then it doesn’t work. So you find what someone on the internet says is a solution, so you try that.


Kudos to you for asking first. In many cases, those internet suggestions can be catastrophic. This one appears to be safe. It might even work. But if it doesn’t work, then I’m afraid you’re in your own. Homebrew doesn’t have any support, so people come here when it fails, as it so often does. But I would never touch it. Maybe someone else will come along.


Usually there are easier ways to scrape data. This kind of setup would only be necessary if you were trying to scrape data that was created only in JavaScript. That’s really pretty rare. And even then, you could probably use Safari’s web inspector to find the internal Ajax calls and grab the json data directly, where it will be much easier to use.

Oct 29, 2023 12:35 PM in response to VikingOSX


Yes, I know all about that and that's the reason I asked before I went threw with it. I had service pointing one folder short on the proper one. That was fixed and it ran.


As far as security im really thinking of moving to qubes. However the Mac makes it easy for me to do IT for a few people. I left Microsoft after XP, wasn't dealing with their **** anymore lol.


TY you guys, you have made my day easier, you guys have a clue why I was hesitant to go forward.

Oct 28, 2023 4:28 PM in response to lac_ekim

lac_ekim wrote:

➜ ~ which chromedriver
/usr/local/bin/chromedriver


xattr -d com.apple.quarantine /usr/local/bin/chromedriver

This is the reason why im asking the question

You haven't actually asked any questions.

It ran one time but then stopped and I researched the issue im having and came up with that. Can someone more knowledgeable on this specific issue fill me in a little more before I just do this?

Do what?

Oct 28, 2023 6:58 PM in response to etresoft

selenium, the chromedriver dled from brew is being blocked by the mac security thing. This code :


xattr -d com.apple.quarantine /usr/local/bin/chromedriver 


I believe is the code I need to enter. However im worried that this may not be smart because the security warnings. or if you guys have a better way to go im all ears. Also im sorry about the misquote:


➜  ~ brew info chromedriver
==> chromedriver: 118.0.5993.70
https://chromedriver.chromium.org/
/usr/local/Caskroom/chromedriver/118.0.5993.70 (2 files, 16.4MB)
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/c/chromedriver.rb
==> Name
ChromeDriver
==> Description
Automated testing of webapps for Google Chrome
==> Artifacts
chromedriver-mac-x64/chromedriver (Binary)
==> Analytics
install: 6,997 (30 days), 25,330 (90 days), 55,056 (365 days)
➜  ~

not


➜ ~ which chromedriver
/usr/local/bin/chromedriver



listen this is asking for some stuff that could compromise me. I would only like the risks, and what to do. I haven't hit enter to continue the process yet.


simple I want to use selenium and I have road block up because the OS


Oct 28, 2023 7:51 PM in response to etresoft

thanks, good to know, ty. Do you have a suggestion for understand the terminal within Mac. It's a lot like linux but it's different. The security issues are so aggravating, im like walking on egg shells. I switched over to Mac after XP was discontinued. fyi python is to get me more comfortable with it. so I know how to automate tasks of any sort

Oct 28, 2023 9:27 PM in response to lac_ekim

here is a question that I have no clue why its spitting out this. Im trying get the location of chromedriver. I typed in


 which chromedriver

That is supposed to give the location of the prg,

➜  ~ which chromedriver
/usr/local/bin/chromedriver
➜  bin which -a chromedriver
/usr/local/bin/chromedriver


however when I go in there, that file isn't there.


➜  /usr cd local
➜  local cd bin
➜  bin cd chromedriver
cd: not a directory: chromedriver
➜  bin pwd
/usr/local/bin

am I doing something wrong? as you saw the chromedriver I downloaded was threw brew


➜  ~ brew info chromedriver
==> chromedriver: 118.0.5993.70
https://chromedriver.chromium.org/
/usr/local/Caskroom/chromedriver/118.0.5993.70 (2 files, 16.4MB)
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/c/chromedriver.rb
==> Name
ChromeDriver
==> Description
Automated testing of webapps for Google Chrome
==> Artifacts
chromedriver-mac-x64/chromedriver (Binary)
==> Analytics
install: 6,997 (30 days), 25,330 (90 days), 55,056 (365 days)
➜  ~


Im sorry to keep asking questions, this doesn't look correct. If it isn't what do I do lol. basically of what you said, I am not expecting anything. im confused because of the area its claiming is not a true statement, never was. TY etresoft, I truly value you words.



Oct 28, 2023 9:39 PM in response to lac_ekim

NVM, im having issues with my code, This is working

from selenium.webdriver import Chrome
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager


url = "https://automated.pythonanywhere.com"

chrome_options = Options()
chrome_options.add_experimental_option("detach", True)

driver = Chrome(service=Service(ChromeDriverManager().install()),
options=chrome_options)

driver.get(url)
driver.maximize_window()



Ty for all your help, I truly appreciate it. Simply im going to have to figure out the correct way to run this with functional programing because it's not working lol.

Oct 29, 2023 9:26 AM in response to lac_ekim

lac_ekim wrote:

Do you have a suggestion for understand the terminal within Mac. It's a lot like linux but it's different.

Identical, really. The biggest difference is that a certain group of "activists" designed the GPL software license specifically so Apple couldn't use their open-source software. They are fine with Google, Facebook, Meta, etc. using their software to process, sell, and share personal information. Apple has had to go to great efforts over the years to replace those GPL parts of the software with their own software or alternatives (like zsh) whose open-source licenses aren't so restrictive.

The security issues are so aggravating, im like walking on egg shells.

Such is the world today. There is an entire industry of people who hack Apple devices for a living. I'm not talking about hoodie-wearing hackers named "Cipher", or North Koreans. It's big business. Google in particular has a division dedicated to hacking - all in the name of "user security" of course. And there are lots of social media "influencers" in the security community who hack Apple devices for "bug bounties" or just as advertising to drive their "white hack" consulting business. All of this is totally out in the open and totally legal. Yet somehow, Apple is always the target.

fyi python is to get me more comfortable with it. so I know how to automate tasks of any sort

It would be better to install Python from the original distribution at https://python.org


Homebrew will cause no end of problems. I usually have to wind up recommending people completely erase their hard drive and reinstall the operating system.

➜ /usr cd local
➜ local cd bin
➜ bin cd chromedriver
cd: not a directory: chromedriver
➜ bin pwd
/usr/local/bin

I'm sorry, but that's all gibberish. I really think it would be better to erase the hard drive and start over. You will need to develop more knowledge of the command line before using Python. Homebrew is going to be a constant source of problems and confusion.

xattr question

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.