Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   How to get the selected text of the webpage in chrome through python ? (http://www.velocityreviews.com/forums/t956293-how-to-get-the-selected-text-of-the-webpage-in-chrome-through-python.html)

iMath 01-08-2013 04:20 AM

How to get the selected text of the webpage in chrome through python ?
 
How to get the selected text of the webpage in chrome through python ?

iMath 01-08-2013 10:52 AM

Re: How to get the selected text of the webpage in chrome throughpython ?
 
在 2013年1月8日星期二UTC+8下午12时20分28秒 ,iMath写道:
> How to get the selected text of the webpage in chrome through python ?


I need the code ,cuz I am only familiar with Python ,so it would be betterto give me the code written in Python .
You can also give me the code in other programming language ,thanks in advance :)

Dennis Lee Bieber 01-08-2013 12:38 PM

Re: How to get the selected text of the webpage in chrome throughpython ?
 
On Mon, 7 Jan 2013 20:20:28 -0800 (PST), iMath <redstone-cold@163.com>
declaimed the following in gmane.comp.python.general:

> How to get the selected text of the webpage in chrome through python ?


Chrome is a browser, is it not... If you want to get the text in
Python, you have to write the equivalent of a browser -- something that
parses the returned HTML message, extracting the parts you want.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/


Dave Angel 01-08-2013 01:11 PM

Re: How to get the selected text of the webpage in chrome throughpython ?
 
On 01/08/2013 07:38 AM, Dennis Lee Bieber wrote:
> On Mon, 7 Jan 2013 20:20:28 -0800 (PST), iMath <redstone-cold@163.com>
> declaimed the following in gmane.comp.python.general:
>
>> How to get the selected text of the webpage in chrome through python ?

> Chrome is a browser, is it not... If you want to get the text in
> Python, you have to write the equivalent of a browser -- something that
> parses the returned HTML message, extracting the parts you want.


To get a selection, you can either wait till it's copied to the
clipboard, and get it from there, or you can write a addon for the
application. Since Chrome accepts addons, I suggest you research that
angle. Probably mozilla.org is the place to start, and function

nsISelectionController::GetSelection() might be some place to examine.

You might find some hints in
http://stackoverflow.com/questions/2...on-and-mozilla


if you are going to work with the clipboard, realize that it works quite
differently from one OS to another, and even from one desktop manager to
another.

--

DaveA


Bruno Dupuis 01-08-2013 01:19 PM

Re: How to get the selected text of the webpage in chrome throughpython ?
 
On Mon, Jan 07, 2013 at 08:20:28PM -0800, iMath wrote:
> How to get the selected text of the webpage in chrome through python ?


What you need is a way to get selected text from wherever it comes. The
way to do this depends on your graphical environment. If you use X, i'd make a
a quick and dirty call to xclip -o, although there must be a pure python
implementation which in turn depends on the python framework you play
with (gtk/qt/wx/tk/...).

Short answer is : it depends on your system, and it may be easier and more
portable if you use a graphical toolkit.

cheers.

--
Bruno Dupuis


Miki Tebeka 01-08-2013 02:01 PM

Re: How to get the selected text of the webpage in chrome throughpython ?
 
On Monday, January 7, 2013 8:20:28 PM UTC-8, iMath wrote:
> How to get the selected text of the webpage in chrome through python ?


You can probably use selenium to do that.

iMath 01-09-2013 02:47 AM

Re: How to get the selected text of the webpage in chrome throughpython ?
 
在 2013年1月8日星期二UTC+8下午9时19分51秒 Bruno Dupuis写道:
> On Mon, Jan 07, 2013 at 08:20:28PM -0800, iMath wrote:
>
> > How to get the selected text of the webpage in chrome through python ?

>
>
>
> What you need is a way to get selected text from wherever it comes. The
>
> way to do this depends on your graphical environment. If you use X, i'd make a
>
> a quick and dirty call to xclip -o, although there must be a pure python
>
> implementation which in turn depends on the python framework you play
>
> with (gtk/qt/wx/tk/...).
>
>
>
> Short answer is : it depends on your system, and it may be easier and more
>
> portable if you use a graphical toolkit.
>
>
>
> cheers.
>
>
>
> --
>
> Bruno Dupuis


I use it on WinXP , I also learned PyQt4 .
can u help ?

iMath 01-09-2013 02:47 AM

Re: How to get the selected text of the webpage in chrome throughpython ?
 
在 2013年1月8日星期二UTC+8下午9时19分51秒 Bruno Dupuis写道:
> On Mon, Jan 07, 2013 at 08:20:28PM -0800, iMath wrote:
>
> > How to get the selected text of the webpage in chrome through python ?

>
>
>
> What you need is a way to get selected text from wherever it comes. The
>
> way to do this depends on your graphical environment. If you use X, i'd make a
>
> a quick and dirty call to xclip -o, although there must be a pure python
>
> implementation which in turn depends on the python framework you play
>
> with (gtk/qt/wx/tk/...).
>
>
>
> Short answer is : it depends on your system, and it may be easier and more
>
> portable if you use a graphical toolkit.
>
>
>
> cheers.
>
>
>
> --
>
> Bruno Dupuis


I use it on WinXP , I also learned PyQt4 .
can u help ?

iMath 01-09-2013 02:54 AM

Re: How to get the selected text of the webpage in chrome throughpython ?
 
在 2013年1月8日星期二UTC+8下午9时11分30秒 Dave Angel写道:
> On 01/08/2013 07:38 AM, Dennis Lee Bieber wrote:
>
> > On Mon, 7 Jan 2013 20:20:28 -0800 (PST), iMath <redstone-cold@163.com>

>
> > declaimed the following in gmane.comp.python.general:

>
> >

>
> >> How to get the selected text of the webpage in chrome through python ?

>
> > Chrome is a browser, is it not... If you want to get the text in

>
> > Python, you have to write the equivalent of a browser -- something that

>
> > parses the returned HTML message, extracting the parts you want.

>
>
>
> To get a selection, you can either wait till it's copied to the
>
> clipboard, and get it from there, or you can write a addon for the
>
> application. Since Chrome accepts addons, I suggest you research that
>
> angle. Probably mozilla.org is the place to start, and function
>
>
>
> nsISelectionController::GetSelection() might be some place to examine.
>
>
>
> You might find some hints in
>
> http://stackoverflow.com/questions/2...on-and-mozilla
>
>
>
>
>
> if you are going to work with the clipboard, realize that it works quite
>
> differently from one OS to another, and even from one desktop manager to
>
> another.
>
>
>
> --
>
>
>
> DaveA


It seems need Javascript to work it on .
Unfortunately ,I am only familiar with python .

iMath 01-09-2013 02:54 AM

Re: How to get the selected text of the webpage in chrome throughpython ?
 
在 2013年1月8日星期二UTC+8下午9时11分30秒 Dave Angel写道:
> On 01/08/2013 07:38 AM, Dennis Lee Bieber wrote:
>
> > On Mon, 7 Jan 2013 20:20:28 -0800 (PST), iMath <redstone-cold@163.com>

>
> > declaimed the following in gmane.comp.python.general:

>
> >

>
> >> How to get the selected text of the webpage in chrome through python ?

>
> > Chrome is a browser, is it not... If you want to get the text in

>
> > Python, you have to write the equivalent of a browser -- something that

>
> > parses the returned HTML message, extracting the parts you want.

>
>
>
> To get a selection, you can either wait till it's copied to the
>
> clipboard, and get it from there, or you can write a addon for the
>
> application. Since Chrome accepts addons, I suggest you research that
>
> angle. Probably mozilla.org is the place to start, and function
>
>
>
> nsISelectionController::GetSelection() might be some place to examine.
>
>
>
> You might find some hints in
>
> http://stackoverflow.com/questions/2...on-and-mozilla
>
>
>
>
>
> if you are going to work with the clipboard, realize that it works quite
>
> differently from one OS to another, and even from one desktop manager to
>
> another.
>
>
>
> --
>
>
>
> DaveA


It seems need Javascript to work it on .
Unfortunately ,I am only familiar with python .


All times are GMT. The time now is 09:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.