Don't set timeout when we can't create client

Fixes panic
1 files changed, 3 insertions(+), 3 deletions(-)

M main.go
M main.go +3 -3
@@ 51,13 51,13 @@ func (c *Client) connect() selenium.WebD
 			var err error
 
 			c.driver, err = selenium.NewRemote(c.Capabilities, c.URL)
-			if c.Timeout != 0 {
-				c.driver.SetPageLoadTimeout(c.Timeout)
-			}
 			if err != nil {
 				logger.Println("Error connecting to", c.URL, err)
 				time.Sleep(30 * time.Second)
 			} else {
+				if c.Timeout != 0 {
+					c.driver.SetPageLoadTimeout(c.Timeout)
+				}
 				c.startTime = time.Now()
 				break
 			}