Question: I need to analyse web page contents. Page has javascrips. 
Can you advice on better way than using Selenium?

If not:
page when loaded in browser has elements:

```
<div class="js-container">    <table class="zebra" style="width: 100%;">
        <tbody><tr>
            <th>A</th>
            <th>B</th>
            <th>C</th>
        </tr>
            <tr>
                <td>A1</td>
                <td>A2</td>
                <td>
                    <a href="http://X" style="color: black">T1</a>
                </td>
            </tr>
            <tr>
                ....
            </tr>
....

```

I need to read a table, element by element. I run for example:

`myList = myDriver.find_elements_by_class_name("js-container")`.

Then how do I get inner elements of "js-container" object?

The only element resulting myList has is: `print (myList[0])`:

```
<selenium.webdriver.remote.webelement.WebElement (session="61238", element="{71293}")>

```

Answer: 
**For Swift 4:**

```
typealias Completion = (Error?) -> Void 

func changePassword(email: String, currentPassword: String, newPassword: String, completion: @escaping Completion) {
    let credential = EmailAuthProvider.credential(withEmail: email, password: currentPassword)
    Auth.auth().currentUser?.reauthenticate(with: credential, completion: { (error) in
        if error == nil {
            currentUser.updatePassword(to: newPassword) { (errror) in
                completion(errror)
            }
        } else {
            completion(error)
        }
    })
}

```

Firebase Documentation can be found [here](https://firebase.google.com/docs/auth/ios/manage-users#re-authenticate_a_user)
**For Swift 5 to change password in firebase**

```
import Firebase

func changePassword(email: String, currentPassword: String, newPassword: String, completion: @escaping (Error?) -> Void) {
        let credential = EmailAuthProvider.credential(withEmail: email, password: currentPassword)
        Auth.auth().currentUser?.reauthenticate(with: credential, completion: { (result, error) in
            if let error = error {
                completion(error)
            }
            else {
                Auth.auth().currentUser?.updatePassword(to: newPassword, completion: { (error) in
                    completion(error)
                })
            }
        })
    }

```

**How to use ?**

```
self.changePassword(email: "abcemail@gmail.com", currentPassword: "123456", newPassword: "1234567") { (error) in
        if error != nil {
            self.showAlert(title: "Error" , message: error?.localizedDescription)
        }
        else {
            self.showAlert(title: "Success" , message: "Password change successfully.")
        }
    }

```