crespozooo 1 Posted September 18, 2014 Report Share Posted September 18, 2014 It's a site similar to yahoo answers. I just can't figure it out how to thumbs up a certain user. Tried all method, even offsets are random.example: http://www.gutefrage.net/frage/kennt-jemand-gute-ego-shooter-spiele-fuer-playstation-3 Quote Link to post Share on other sites
AutomationNinja 194 Posted September 18, 2014 Report Share Posted September 18, 2014 so a thumbs up would be a "ja" ? Quote Link to post Share on other sites
Bot-Factory 602 Posted September 19, 2014 Report Share Posted September 19, 2014 so a thumbs up would be a "ja" ?No, he means after logging in to the site. There are small symbols left of the user answers. He want's to click on those. Dan Quote Link to post Share on other sites
Bot-Factory 602 Posted September 19, 2014 Report Share Posted September 19, 2014 I took a quick look. When you select the thumbs up element you have to move the mouse up to the number a little bit. So that the blue area and the number is slected. Wrong:<tagname="a"> Correct:<class="diggIt"> The right click element is:click($element offset(<class="diggIt">, 3), "Left Click", "No") There the numbers don't change. They are in the exact order. Now you only have to figure out the correct position. Scraping all the usernames into a list and then finding the name you are looking for should give you the right position. But be careful! The element number starts with 1 and the list starts with 0. So if the username is list item2, then the element is 3. Dan 1 Quote Link to post Share on other sites
crespozooo 1 Posted September 19, 2014 Author Report Share Posted September 19, 2014 I took a quick look. When you select the thumbs up element you have to move the mouse up to the number a little bit. So that the blue area and the number is slected. Wrong:<tagname="a"> Correct:<class="diggIt"> The right click element is:click($element offset(<class="diggIt">, 3), "Left Click", "No") There the numbers don't change. They are in the exact order. Now you only have to figure out the correct position. Scraping all the usernames into a list and then finding the name you are looking for should give you the right position. But be careful! The element number starts with 1 and the list starts with 0. So if the username is list item2, then the element is 3. DanTried that also, seems like it's not clicking on thumbs up. Maybe I'm doing something wrong. You tested it by run node? Quote Link to post Share on other sites
bigmatt 0 Posted September 19, 2014 Report Share Posted September 19, 2014 Actually that helped me too Quote Link to post Share on other sites
crespozooo 1 Posted September 19, 2014 Author Report Share Posted September 19, 2014 Actually that helped me too Did you manage to give thumps up with dan's method? If so,how? I click run node and it's not working. Quote Link to post Share on other sites
Bot-Factory 602 Posted September 19, 2014 Report Share Posted September 19, 2014 Hmm... It's not clicking the element for me either... In HTTP mode I would know a solution :-)But the click elements stuff is a bit strange. I played around with:click($element child($element offset(<class="diggIt">, 6)), "Left Click", "No") But that didn't work either. I'm not sure if $element child does work with the click command? Dan Quote Link to post Share on other sites
Marton 48 Posted September 19, 2014 Report Share Posted September 19, 2014 Hmm... It's not clicking the element for me either... In HTTP mode I would know a solution :-)But the click elements stuff is a bit strange. I played around with:click($element child($element offset(<class="diggIt">, 6)), "Left Click", "No") But that didn't work either. I'm not sure if $element child does work with the click command? Dan Hi, you'll need the sibling of the child of the offset (lol, if it wasn't confusing enough already ): click($element sibling($element child($element offset(<class="diggIt">, 2))), "Left Click", "No") All the best,Marton 1 Quote Link to post Share on other sites
crespozooo 1 Posted September 19, 2014 Author Report Share Posted September 19, 2014 Diggit belongs the number of likes that comment has. Has nothing to do with thumbs up .Marton's method worked fine. Thanks! Quote Link to post Share on other sites
Bot-Factory 602 Posted September 19, 2014 Report Share Posted September 19, 2014 Hi, you'll need the sibling of the child of the offset (lol, if it wasn't confusing enough already ): click($element sibling($element child($element offset(<class="diggIt">, 2))), "Left Click", "No") All the best,MartonHmm.. that's interesting. Could you show an example with the html code of that site? The answer element starts with:<div class="answer clearfix"> Then the elements I already voted on have:<div class="diggedIt">3</div> and the elements I didn't vote yet have:<div class="diggIt">0</div> So we are selecting the diggIt class. Then with element child we select <div class="answer clearfix"> right? But I don't understand what element we click now exactly? I'm confused...I'm more used to fiddler traces these days :-)Dan Quote Link to post Share on other sites
crespozooo 1 Posted September 20, 2014 Author Report Share Posted September 20, 2014 how can I find the position of a username in a list? for example I have a list of 5 elements as it follows:ab c d e and I want to store inside a variable the position of the fourth element, "d", which is 4 Quote Link to post Share on other sites
Pete 121 Posted September 20, 2014 Report Share Posted September 20, 2014 how can I find the position of a username in a list? for example I have a list of 5 elements as it follows:ab c d e and I want to store inside a variable the position of the fourth element, "d", which is 4 Lists a zero based so d is list item 3 clear list(%items)add list to list(%items, $list from text("abcdef", $new line), "Delete", "Global")set(#find, "d", "Global")set(#listposition, $eval("var items = [\"{$replace(%items, $new line, "\",\"")}\];var position = items.indexOf(\"{#find}\");position;"), "Global") Quote Link to post Share on other sites
crespozooo 1 Posted September 20, 2014 Author Report Share Posted September 20, 2014 WTF I ran it and debugger gave me -1 instead of 4. HmmmLists a zero based so d is list item 3 clear list(%items)add list to list(%items, $list from text("abcdef", $new line), "Delete", "Global")set(#find, "d", "Global")set(#listposition, $eval("var items = [\"{$replace(%items, $new line, "\",\"")}\];var position = items.indexOf(\"{#find}\");position;"), "Global") Quote Link to post Share on other sites
arunner26 51 Posted September 21, 2014 Report Share Posted September 21, 2014 crespozooo, You could do it like this: clear list(%items)add list to list(%items, $list from text("abcdef", $new line), "Delete", "Global")set(#find, "d", "Global")set(#Current_List_Position, 0, "Global")loop while($list total(%items) > #Current_List_Position) { if($list item(%items, #Current_List_Position) = #find) { then { set(#listposition, #Current_List_Position, "Global") alert("Found it at position: {#listposition}") set(#Current_List_Position, $add($list total(%items), 1), "Global") } else { set(#Current_List_Position, $add(#Current_List_Position, 1), "Global") } }} Quote Link to post Share on other sites
Pete 121 Posted September 21, 2014 Report Share Posted September 21, 2014 go into the evalthen replacewhere it says replace textand the value is "," quote the input so it is not parsed as a maths expression I think that's your problem Quote Link to post Share on other sites
crespozooo 1 Posted September 21, 2014 Author Report Share Posted September 21, 2014 Okay solved that. New problem is: there are replies also.So when scraping users the ones who replied are also scraped.thing is the reply of reply has no thumbs up and will fuck my positioning. Any workaround? Quote Link to post Share on other sites
arunner26 51 Posted September 21, 2014 Report Share Posted September 21, 2014 crespozoooYes, there is probably a work-around but I don't think we have enough information to suggest one. Quote Link to post Share on other sites
crespozooo 1 Posted September 21, 2014 Author Report Share Posted September 21, 2014 crespozoooYes, there is probably a work-around but I don't think we have enough information to suggest one. Well let me make myself clear.I want to scrape all users from the answers because I need the order,to know on which position is my user(ex:5) and to click the 5th thumbs up button. Thing is there are replies to the answers also. And replies to the replies(which do not have a thumbs up button) which causes to fck up my order. Get it now? Like there will be more users than thumbs up buttons. 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.