Project

General

Profile

Feature #1149

Interactively allow creation of selector

Added by Luke Murphey over 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Category:
-
Target version:
-
Start date:
01/15/2016
Due date:
% Done:

100%


Description

Add the ability to interactively create a selector from the UI.

This can be done with something like the SelectorGadget (http://selectorgadget.com/). It could work like this:

  1. Have a link to open the defined web-page with the selector gadget loaded and the selector set accordingly
  2. If a URL is not yet defined, then just show a warning
  3. Add in a dialog that tells the user that the red box is for removing matches

Subtasks

Task #1150: Include selector gadgetClosedLuke Murphey

Task #1151: Wire up hook to set URL in selector windowRejectedLuke Murphey

Task #1152: Wire up hook to get selector from selector windowRejectedLuke Murphey

Task #1153: Wire up hook to set selector in selector windowRejectedLuke Murphey

Task #1154: Wire up close button to close selector windowRejectedLuke Murphey

Task #1155: Improve loading screenClosedLuke Murphey

Task #1156: Remove xpath dialogRejectedLuke Murphey

Task #1157: Improve instructionsClosedLuke Murphey

History

#2 Updated by Luke Murphey over 8 years ago

If using selector gadget, changes include:
  • Nicer loading screen
  • Guidance that you should click red boxes to limit matches
  • Callback so that selector info is sent back to input page
  • Close button should close the page too
  • Needs to support setting the selector externally
  • Remove xpath option
  • Might want to disable links (or obtain link from page if it changes)

#3 Updated by Luke Murphey about 8 years ago

Turns out that you can't do this. The browser won't allow it unless they are on the same domain (https://github.com/cantino/selectorgadget/pull/4).

#4 Updated by Luke Murphey about 8 years ago

Could include this as a bookmarklet.

#5 Updated by Luke Murphey almost 8 years ago

I might be able to make this happen by making a proxy within Splunk. I could use rewrite_links() within lxml to re-write the links (http://stackoverflow.com/questions/5789127/how-to-replace-links-using-lxml-and-iterlinks).

#6 Updated by Luke Murphey over 7 years ago

To try the proxy, I would need:

  1. To write a simple Python proxy within Splunk (authentication would need to be required)
  2. Re-write the URLs accordingly
  3. Put restrictions on the proxy requests (authenticated user, would need the ability to create a web_input, size limitation)

#7 Updated by Luke Murphey over 7 years ago

Some thoughts:
  • Might want to block following links in the iframe
  • Allowing following the links using the internal proxy (and updating the URL accordingly)

#9 Updated by Luke Murphey over 7 years ago

The DomPredictionHelper is what is used to make the CSS selector. See https://github.com/cantino/selectorgadget/blob/master/spec/test_sites/test/testDom.html.

https://www.reddit.com/r/webdev/comments/1xh1g6/does_there_exist_a_dom_navigator_that_calculates/

var Predict = new DomPredictionHelper();
$(document.body).on('click', function (e) {
    var elem = document.elementFromPoint(e.clientX, e.clientY);
    alert(Predict.getPathsFor([elem]));
});

#10 Updated by Luke Murphey over 7 years ago

Some things I don't like about the current approach:

#11 Updated by Luke Murphey over 7 years ago

  • Status changed from New to Closed

Also available in: Atom PDF