tebelorg / RPA-Python

Python package for doing RPA
Apache License 2.0
4.96k stars 669 forks source link

Linux环境下运行 - pending replication details (maybe can't connect to Chrome) #511

Closed liutingqin closed 3 months ago

liutingqin commented 10 months ago

你好,我在linux环境下运行时,在执行r.init()之后,代码一直没有反应。 r.setup()执行正常。 我查看了之前关于linux系统的issue,发现最终好像都没有解决此问题,所以想问一下,这种情况该如何解决。 谢谢!

liutingqin commented 10 months ago

运行图片

kensoh commented 10 months ago

Hi @liutingqin, if it hangs there, it normally means cannot connect to Chrome browser. Maybe because of company IT policy blocking connecting to Chrome using websocket connection directly.

What is your Python script, do you just do r.init()?

Can you do r.debug(True) before r.init() to see if there is any other clue?

liutingqin commented 10 months ago

谢谢回答,我做了很多次尝试与测试。我在ubuntu16.04与ubuntu20.04中运行代码时,会卡在r.init()过程中,如上图所示。后面我用ubuntu22.04的环境运行代码,代码跑通了,所以我想代码中是否有bug,导致不与非最新版本的ubuntu兼容。

liutingqin commented 10 months ago

我的python script用的你的colab上的代码,所有环境都用的此代码。

kensoh commented 10 months ago

Thanks for your reply!

It'll be hard to debug without getting more info using r.debug() before running r.init(). Does using r.debug() show anything?

When you run php -v from your Ubuntu terminal does it show different results for the 2 Ubuntu?

The rpa package uses TagUI engine which uses 1) built-in PhantomJS engine and 2) PHP in order to convert take the automation instructions and send it to Chrome to automate the actions on Chrome browser. It might be somewhere around there. Or something to do with firewall blocking connecting to Chrome with websocket connection.

kensoh commented 10 months ago

(I can understand Chinese you can continue to reply in Chinese)

liutingqin commented 10 months ago

你好! 我在r.init()的前面,使用了r.debug(),同样没有任何信息,也没有报错。 php的版本是PHP 8.1.2-1ubuntu2.14 (cli) (built: Aug 18 2023 11:41:11) (NTS)。 但是我在ubuntu22.04上运行成功了,因为我查了colab上的ubuntu环境版本是22.04,colab上的代码能直接运行成功。 所以我想,是否是相关依赖版本不兼容的问题。 因为我查看之前的issue,403和404issue好像与我的情况一致,最终都没有解决,所以我猜测这是一个普遍性问题。

kensoh commented 10 months ago

Can you show me the Python code and steps you take to install and run? On the Ubuntu that does not work.

The Colab example has some setup steps that are designed for the new Ubuntu version, in order to install Chrome.

For example, below steps might not work on older Ubuntu, new Ubuntu requires below to install Chromium browser.

image

liutingqin commented 10 months ago

谢谢,我现在已经将环境换成了ubuntu22.04,已经能够无头运行r.init()。但我现在想问一下,我已经安装了有桌面的ubuntu环境,我想在有桌面的ubuntu环境下启动rpa,我该如何配置,我发现我直接运行r.setup()之后再运行r.init()好像行不通,依旧是在r.init()这一步卡住。我是否需要设置--no-sandbox相关配置。谢谢!

liutingqin commented 10 months ago

我想应该是要进行r.dump(r.load('/root/.tagui/src/tagui').replace('"google-chrome"', '"chromium"').replace('$headless_switch', '--no-sandbox'), '/root/.tagui/src/tagui')此配置。 但我不知道'$headless_switch'应该换成什么配置才能进行有头访问。

liutingqin commented 10 months ago

谢谢,这个问题我已经解决。我发现用colab上的代码设置就已经可以实现。

oujiale401 commented 4 months ago

请问colab的链接在哪里

kensoh commented 3 months ago

@liutingqin , so sorry I just got to catch up on issues reported here! Thanks for raising this.

Hi @oujiale401 it is on the top of the readme page, the link is https://colab.research.google.com/drive/1or8DtXZP8ZxJYK52me0dA6O9A1dXKKOE?usp=sharing