Question: This sounded simple, but I haven't been able to figure it out.

Context: a VC tells a view to animate itself and the VC waits the animation to be completed before.

I thought about doing something like this:

In ViewController:

```
loadingView.animate()

```

In LoadingView (UIView subclass):

```
animate() -> Bool {
    UIView.animate(withDuration: 1.0, animations: {
        self.imageViewCenterYConstraint.constant -= 20
        self.layoutIfNeeded()
    }, completion {
         return true // This line obviously doesn't work.
    })
}

```

I do not want to include the rest of the code inside the completion block. The rest of the code is in the VC.

I suspect that all this should rather be done with an additional completion handler to add to the animate func.

PS: Just in case you know of a better solution/best practices, here is more context: I display a loading animation and remove it once I have retrieved data from the network. I always want to wait for the animation to complete before removing, even if the network data was already downloaded. Don't want to stop the animation at half of it.

Answer: 
My experience with Selenium is limited to some niche cases where I wanted some automation (for scraping I can normally get by with requests and BeautifulSoup) but I believe the reason you are getting **None** is because `execute_script` doesn't return a value to begin with (your script is basically just being injected into the webpage and executed within the browser). Iirc, you should be able to parse your jquery out to (verbosely):

```
div = driver.find_element_by_class_name("targetclass")
targeta = div.find_element_by_link_text("target@email.com")
tr = targeta.parent.parent
retrieve = tr.find_element_by_tag_name("a")
aurlval = retrieve.getattribute("href")

```

I can't recall of the top of my head if Selenium has separate methods for list vs first-element, so you may have to take the zero index on those lines.
One way is to use javascript as below to get the table row along with the previous answers steps. WebDriver doesn't have a 'parent' method of its own.

```
div = driver.find_element_by_class_name("targetclass")
targeta = div.find_element_by_link_text("target@email.com")
tr = self.driver.execute_script("return arguments[0].parentNode.parentNode;", targeta)

```

Then you can find elements in the row.

Or you can try "return arguments[0].parentNode;" which should get the td and then try to get previous-sibling, but I haven't tried that.