Skip to content

Instantly share code, notes, and snippets.

@o0101
Last active August 28, 2020 10:31
Show Gist options
  • Save o0101/03b384dfa4b85efd445ef37c0d9bb49d to your computer and use it in GitHub Desktop.
Save o0101/03b384dfa4b85efd445ef37c0d9bb49d to your computer and use it in GitHub Desktop.
format
recordname:product-detail
repeatall:nextpage click:.nav-nxt-btn
name:string innerText:.name-prd
price:float innerText:.sale-price
pageuri:url attr:href:.detail-view-lnk
@o0101
Copy link
Author

o0101 commented Feb 28, 2018

How to parse this?

Lines -> colon-separated-tuples-> objects

The important point / limitation of this format is

that selectors can contain spaces

so they are always the last thing on the line

@o0101
Copy link
Author

o0101 commented Feb 28, 2018

But is this too complicated ???

for a property we need:

  • prop name
  • prop type
  • element selector
  • element part selector

so we have all that information

why don't we just pick a chatacter that is not valid in css selectors?

&

probably

so basically we have

recordname/product-detail
repeatall/nextpage/click/.nav-nxt-btn

name/string/innerText/.name-prd span
price/float/innerText/.sale-price i

OKay but a problem i have run into is that, yes, as I suspected / knew
CSS can contain ANYTHING

so long as it is escaped

so my new format is like this

recordname profile
repeatall next

but no i do not want selector on the next line. f that.

so i know what i will do.

a selector, when included, must have a special prefix.

the prefix only has to be unique among the codewords and prop names

So we have a requirement that a property can not be called the prefix

so what prefix??? let's try a simple one

recordname profile
repeatall click sel .next-btn a

realname string innerText sel .frnd-name span
picture image attr src sel .profile-pic img

i think that's okay

@o0101
Copy link
Author

o0101 commented Feb 28, 2018

I like this because we will not have any annoying characters just spaces

it's very speakable

which is useful

@o0101
Copy link
Author

o0101 commented Mar 1, 2018

there seem a lot of challenges with automating browsers.

principally, the click challenge

which is, i click on someplace and get a result
but then when i tell the rb ( remote browser ) to click on the same place, no result

my solution ( have not tested )

record the click location and get element from point ( all elements in stack )
then in the remote page, get these elements.
and get their bounding boxes.
then execute clicks in the bounding boxes of these elements, until we get result.
start at top of z stack and work down.
do not use
click

use mousedown, mouseup
or rather use CDP to iniate an actual trusted remote mouse interaction click / touch.

i don't know about using chromeless and CDP, maybe i can look at the code.
maybe it works to chuck chromeless and have my own proxy. but the lambda solution of chromeless is too good.
maybe i will just use chromeless for the lambda and proxy and write my own interface to send CDP commands.

good idea! probably

@o0101
Copy link
Author

o0101 commented Mar 1, 2018

also. because of challenges, i can give up. this challenges may be too strong for me. maybe i can not overcome then.
but i choose to keep going. for now anyway. i want to make this thing.

also i probably should make a phone app so i can avoid skype issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment