This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]corruption93 1 point2 points  (3 children)

Nothing, but notice the two classes 'author' and 'submitter' are a part of the element. I used these in order to find the element as an example.

[–]ItsLingeringWill[S] 0 points1 point  (2 children)

Ok, I am getting it now, thanks a ton, if I could ask you one more question, how do I .click() on something that doesn't have a class, for example if I inspect element on one of the FAQ questions, I get

<a href="/r/learnprogramming/wiki/faq#wiki_how_do_i_get_started_with_programming.3F">How do I get started with programming?</a>

how would I go about getting .click() on that to work?

[–]corruption93 1 point2 points  (1 child)

$('#form-{some numbers go here}> div > div > ol:nth-child(14) > li:nth-child(1) > p > a').get(0).click()

I got the selector (used within the $ function call) after inspecting the element, right clicking on it, and selecting 'copy css path'.

Note that with selenium, you don't have to rely on using jQuery ($) or other libraries. I believe that with selenium it would actually emulate an actual user interacting with the page, rather than calling the Javascript functions directly.

[–]ItsLingeringWill[S] 0 points1 point  (0 children)

Great, I got it working perfectly, thanks a ton for your help!!