Get is a smart helper to get the browser executable path. If [Browser.BinPath] is not valid it will auto download the browser to [Browser.BinPath].
()
| 153 | // Get is a smart helper to get the browser executable path. |
| 154 | // If [Browser.BinPath] is not valid it will auto download the browser to [Browser.BinPath]. |
| 155 | func (lc *Browser) Get() (string, error) { |
| 156 | defer leakless.LockPort(lc.LockPort)() |
| 157 | |
| 158 | if lc.Validate() == nil { |
| 159 | return lc.BinPath(), nil |
| 160 | } |
| 161 | |
| 162 | // Try to cleanup before downloading |
| 163 | _ = os.RemoveAll(lc.Dir()) |
| 164 | |
| 165 | return lc.BinPath(), lc.Download() |
| 166 | } |
| 167 | |
| 168 | // MustGet is similar with Get. |
| 169 | func (lc *Browser) MustGet() string { |