1

If I have something like this:

<div class="class1">
    <img src="image.jpg" id="image1">
</div>

How do I move this image to another div in tritium?

3 Answers3

2

I think this should work, try it out (class2 is the id of the class to what you want to move the image):

$("//div[contains(@class,'class2')]") {
  move_here("//img[@id='image1']")
}

There might be other ways but this is quite simple and working.

SysGen
  • 604
  • 7
  • 29
  • I've made a play.tritium.io example given your solution here: http://play.tritium.io/6526e5d20c148c1634bb8094fffb8c55a13c3d76 – noj May 13 '13 at 01:49
  • Using move_to is the same, except the xpath's are reversed: http://play.tritium.io/b55fd00f69ce0dc497198806d5ed0b816c04abf0 – noj May 13 '13 at 01:50
1

I figured out that I need to use move_to() but I don't know how exactly. If someone explain I'd be glad.

0
html() {
 $("//img[@id='image1']") {
  move_to("//div[contains(@class,'class2')]")
  }
 }

Can also be done using move_to function. http://tester.tritium.io/6526e5d20c148c1634bb8094fffb8c55a13c3d76