Install and load
install.packages("RSelenium")
library(RSelenium)
library(rvest)
library(dplyr)
Start a Selenium server and browser
rD <- rsDriver(browser = "chrome", port = 4567L, verbose = FALSE)
remDr <- rD$client
Go to FDIC exam schedule page
url <- "https://www.fdic.gov/resources/bankers/exam-schedule/index.html"
remDr$navigate(url)
Sys.sleep(3) # wait for JS to load
Empty list to hold all rows
all_data <- list()
repeat {
# Get current page source and parse with rvest
page_source <- remDr$getPageSource()[[1]]
page_html <- read_html(page_source)
# Grab the table
tbl <- page_html %>% html_element("table") %>% html_table(fill = TRUE)
all_data <- append(all_data, list(tbl))
# Try clicking "next" if available and not disabled
next_btn <- remDr$findElements(using = 'css selector', value = '.paginate_button.next')
if (length(next_btn) == 0) break # No next button
disabled <- next_btn[[1]]$getElementAttribute("class")[[1]] %>% grepl("disabled", .)
if (disabled) break # Button is disabled, end of pages
next_btn[[1]]$clickElement()
Sys.sleep(2)
}
Combine all into one data frame
df_all <- bind_rows(all_data)
Save to CSV
write.csv(df_all, "fdic_exam_schedule_q2_2025_all_pages.csv", row.names = FALSE)
Stop the browser
remDr$close()
rD$server$stop()
Top comments (1)
library(shiny)
library(shinydashboard)
library(DBI)
library(RPostgres)
ui <- dashboardPage(
dashboardHeader(title = "Dealer Rankings"),
dashboardSidebar(
sidebarMenu(
menuItem("Inputs", tabName = "inputs", icon = icon("sliders-h")),
menuItem("Results", tabName = "results", icon = icon("calculator")),
menuItem("SQL Output", tabName = "sql_output", icon = icon("database"))
)
),
dashboardBody(
tabItems(
tabItem(tabName = "inputs",
fluidRow(
box(title = "TBA", width = 6, solidHeader = TRUE, status = "primary",
numericInput("tba_win_weight", "Win Weight", value = 1),
numericInput("tba_cover_weight", "Cover Weight", value = 0.25)
),
box(title = "Rolls", width = 6, solidHeader = TRUE, status = "primary",
numericInput("rolls_win_weight", "Win Weight", value = 0.15),
numericInput("rolls_cover_weight", "Cover Weight", value = 0)
)
),
fluidRow(
box(title = "Pools", width = 6, solidHeader = TRUE, status = "info",
numericInput("pool_payout_level", "Payout Level", value = 100),
numericInput("pool_wt_payout_level", "Wt @ Payout Level", value = 3),
textInput("pool_extra_wt", "Extra Wt (e.g., ESG)", value = "1,1")
),
box(title = "Limited Comp", width = 6, solidHeader = TRUE, status = "info",
numericInput("limited_cover_weight", "Cover Weight", value = 0.5),
numericInput("limited_comp_weight", "Limited Comp Wt", value = 1)
)
),
fluidRow(
box(title = "Research", width = 12, solidHeader = TRUE, status = "warning",
fluidRow(
column(2, p("T1"),
numericInput("res_t1", "Research", value = 0.05),
numericInput("rel_t1", "Relationship", value = 0.05)),
column(2, p("T2"),
numericInput("res_t2", "Research", value = 0.03),
numericInput("rel_t2", "Relationship", value = 0.03)),
column(2, p("T3"),
numericInput("res_t3", "Research", value = 0.01),
numericInput("rel_t3", "Relationship", value = 0.01)),
column(2, p("Off"),
numericInput("res_off", "Research", value = 0),
numericInput("rel_off", "Relationship", value = 0))
)
)
),
fluidRow(
actionButton("run_btn", "Run Calculation")
),
fluidRow(
verbatimTextOutput("result")
)
),
tabItem(tabName = "results",
fluidRow(
box(title = "Calculation Output", width = 12, solidHeader = TRUE, status = "success",
verbatimTextOutput("result")
)
)
),
tabItem(tabName = "sql_output",
fluidRow(
box(title = "SQL Results", width = 12, solidHeader = TRUE, status = "info",
dataTableOutput("sql_results")
),
box(title = "SQL Query", width = 12, solidHeader = TRUE, status = "warning",
verbatimTextOutput("query_text")
)
)
)
)
)
)
server <- function(input, output, session) {
observeEvent(input$run_btn, {
# Gather all input values
inputs <- list(
tba_win_weight = input$tba_win_weight,
tba_cover_weight = input$tba_cover_weight,
rolls_win_weight = input$rolls_win_weight,
rolls_cover_weight = input$rolls_cover_weight,
pool_payout_level = input$pool_payout_level,
pool_wt_payout_level = input$pool_wt_payout_level,
pool_extra_wt = input$pool_extra_wt,
limited_cover_weight = input$limited_cover_weight,
limited_comp_weight = input$limited_comp_weight,
res = c(input$res_t1, input$res_t2, input$res_t3, input$res_off),
rel = c(input$rel_t1, input$rel_t2, input$rel_t3, input$rel_off)
)
})
}
shinyApp(ui, server)