← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #242471]: Sikuli: Find Element by Id (or xpath)

 

Question #242471 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/242471

    Status: Open => Answered

RaiMan proposed the following answer:
Sikuli has no features to look into the Web GUI. For that you have to
use Selenium.

But I guess, the solution for your problem is, to evaluate the region,
where the user profile image is, relative to another fixed element (e.g.
heading, logo, ...).

example here on this page:
- lets say, the logo in the top left corner is the user profile image (64x64)
- the fixed element is the word Sikuli at the top

Though you might evaluate the following using some screenshot tool or
pixel measure tool (or the IDE Preview's TargetOffset tab), this is a
tiny helper script, that you might save and reuse for other cases.

In the IDE setup this helper script:

img = <a capture of the word Sikuli>
refReg = find(img)
reg = selectRegion() # at runtime select the region of the Sikuli logo
offx = reg.x - refReg.x
offy = reg.y - refReg.y
print "the variable Region coordinates are:"
print "reg = Region(refReg.x + %d, refReg.y + %d, %d, %d)"%(offx, offy, reg.w, reg.h)

Running this script will printout something like
reg = Region(refReg.x + -69, refReg.y + 6, 56, 57)

depending on your captures.

You simply copy and paste this into your real script and adapt it to
your needs.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.