Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It seems the doc is wrong about method: tab.wait(5) #40

Open
codeskyblue opened this issue Jun 12, 2019 · 1 comment
Open

It seems the doc is wrong about method: tab.wait(5) #40

codeskyblue opened this issue Jun 12, 2019 · 1 comment

Comments

@codeskyblue
Copy link

codeskyblue commented Jun 12, 2019

In the document https://fate0.github.io/pychrome/#getting-started there is sample code

# start the tab 
tab.start()
tab.Page.navigate(url="https://github.com/fate0/pychrome", _timeout=5)

# wait for loading
tab.wait(5)

# stop the tab (stop handle events and stop recv message from chrome)
tab.stop()

But when I look inside the pychrome code. wait is defined like this

    def wait(self, timeout=None):
        if not self._started:
            raise RuntimeException("Tab is not running")

        if timeout:
            return self._stopped.wait(timeout)

        self._recv_th.join()
        self._handle_event_th.join()
        return True

The wait should be described as wait for thread stopped, So I think the right document should be

# start the tab 
tab.start()
tab.Page.navigate(url="https://github.com/fate0/pychrome", _timeout=5)


# stop the tab (stop handle events and stop recv message from chrome)
tab.stop()

# wait for thread handle stopped
tab.wait(5)
@Cuile
Copy link

Cuile commented Feb 14, 2020

tab.wait()是在等待线程事件返回内部信号,从外部看是在等待chrome的进程加载页面,并返回结果。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants