\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{fit}

\usepackage[active, tightpage]{preview}
\PreviewEnvironment{tikzpicture}

% taken from https://github.com/luhsra/texmf/blob/main/tex/latex/beamertools/beamertools.sty
\tikzset{
	onslide/.code args={<#1>#2}{%
		\only<#1>{\pgfkeysalso{#2}}
	},
	alt/.code args={<#1>#2#3}{%
		\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
	},
	global opacity/.style={
		opacity=#1,
		text opacity=#1,
		every shadow/.append style={opacity=#1},
		every on layer/.append style={opacity=#1},
		every node/.append style={opacity=#1},
		prefix after command={\pgfextra{\tikzset{every pin/.style={opacity=#1},
		every pin edge/.style={opacity=#1},
		every label/.style={opacity=#1}}}},
	},
	invisible/.style={global opacity=0},
	visible/.style={global opacity=1},
	visible on/.style={alt=#1{}{invisible}},
	invisible on/.style={alt=#1{invisible}{}},
}

\begin{document}
	\begin{frame}
		\begin{tikzpicture}
			\node[draw, visible on=<1>] (fp) {First Page};
			\node[draw, visible on=<2>] (sp) {Second Page};
			\node[draw, fit=(fp)(sp)] {};
		\end{tikzpicture}
	\end{frame}

\end{document}
