我的macOS中的.bash_profile中有几行代码用于张量流。
Sub WebScraper()
Dim driver As New IEDriver
Dim sh As Worksheet
Dim rw As Range
Dim i As Integer
i = 2
website = Elig_Check_Form.Website_CBX.Text
UserName = Elig_Check_Form.Username_TXT.Text
Password = Elig_Check_Form.Password_TXT.Text
LName = Sheets(1).Cells(i, 3).Value
FName = Sheets(1).Cells(i, 2).Value
DOB = Format(Sheets(1).Cells(i, 4).Value, "MM/DD/YYYY")
DOS = Format(Sheets(1).Cells(i, 5).Value, "MM/DD/YYYY")
EligStart = Sheets(1).Cells(i, 8).Value
EligEnd = Sheets(1).Cells(i, 9).Value
EligStat = Sheets(1).Cells(i, 7).Value
WebsiteURL = "https://healthid.optum.com/tb/app/index.html?TARGET=https%3A2F%2Fprovider-linkhealth.unitedhealthcareonline.com%2Fb2c%2FLoginAction.do3Ftype%3DTmV0c2NhcGUjNS4wIChXaW5kb3dzIE5UIDYuMTsgV09XNjQ7IFRyaWRlbnQvNy4wOyBTTENDMjsgLk5FVCBDTFIgMi4wLjUwNzI3OyAuTkVUIENMUiAzLjUuMzA3Mjk7IC5ORVQgQ0xSIDMuMC4zMDcyOTsgLk5FVDQuMEM7IC5ORVQ0LjBFOyBydjoxMS4wKSBsaWtlIEdlY2tvI2ZhbHNlIzEx&relyingAppId=UHO60026#/login"
driver.Get WebsiteURL
driver.Window.Maximize
driver.FindElementById("userNameId_input").SendKeys (UserName) 'Reads Username
driver.FindElementById("passwdId_input").SendKeys (Password) 'Reads password
driver.FindElementById("SignIn").Click
Application.Wait (Now + TimeValue("0:00:10"))
On Error GoTo PasswordErr
driver.FindElementByXPath("//*[@id='app']/div/div[1]/div[2]/div[2]/div[5]/div[7]/div/a").Click
On Error Resume Next
driver.FindElementByName("AGREE").Click
'On Error GoTo 0
driver.FindElementByXPath("//*[@id='app']/div/div[1]/div[2]/div[2]/div[5]/div[12]/div/a/div/h3").Click
Application.Wait (Now + TimeValue("0:00:05"))
driver.FindElementByName("save").Click
On Error GoTo ChooseProvider
'Do Until IsEmpty(Cells(iFib, 1))
Do While i < 1000 And Format(LName) <> vbNullString
Set sh = ActiveSheet
For Each rw In sh.Rows
driver.FindElementById("NameDateOfBirth-searchoptions").Click
driver.FindElementById("last-name-[0]").SendKeys (LName)
driver.FindElementById("first-name-[0]").SendKeys (FName)
driver.FindElementById("date-of-birth-[0]").SendKeys (DOB)
driver.FindElementById("service-start-[0]").SendKeys (DOS)
driver.FindElementById("search-button").Click
Application.Wait (Now + TimeValue("0:00:05"))
On Error GoTo NotFound
Sheets(1).Cells(i, 12).Value = driver.FindElementByXPath("//*[@id='patient- provider-information-section']/div/div/div[1]/div[1]/div/div[2]/div[1]/div/div/div[2]/div[1]/p").Text
Sheets(1).Cells(i, 11).Value = driver.FindElementByXPath("//*[@id='patient-provider-information-section']/div/div/div[1]/div[1]/div/div[2]/div[1]/div/div/div[1]/div/div/span/span[1]/h3").Text
Sheets(1).Cells(i, 10).Value = driver.FindElementByXPath("//*[@id='insurance-information-section']/div/div[1]/div/div[1]/div/div/div[1]/div/p").Text
Sheets(1).Cells(i, 8).Value = Left(driver.FindElementByXPath("//*[@id='insurance-information-section']/div/div[1]/div/div[1]/div/div/div[1]/div/p").Text, 10)
Sheets(1).Cells(i, 9).Value = Right(driver.FindElementByXPath("//*[@id='insurance-information-section']/div/div[1]/div/div[1]/div/div/div[1]/div/p").Text, 10)
If Sheets(1).Cells(i, 5).Value >= Sheets(1).Cells(i, 8).Value Or Sheets(1).Cells(i, 5).Value < Sheets(1).Cells(i, 9).Value Then
Sheets(1).Cells(i, 7).Value = "Eligible"
Else: Sheets(1).Cells(i, 7).Value = "Not Eligible"
Exit For
End If
driver.FindElementByXPath("//*[@id='ng-app']/div[3]/div/div/div/div/div/div/div/div/div[1]/div[1]/div/div/div/div[2]/ul/li[1]/span").Click
i = i + 1
Next rw
Loop
当我在终端中运行我的python程序时,一切都很好,因为它首先加载了.bash_profile。
但是,PyCharm不会提供.bash_profile。所以,我们需要在PyCharm中提供环境变量。
有人可以帮我更新PyCharm中的那些行。我很难把它弄清楚。