A finite-type, generically finite, dominant morphism of integral schemes induces finite field extension? So I am doing an exercise of Hartshorne - II (3.7).
I am given a finite-type, generically finite, dominant morphism $f: X \longrightarrow Y$ of integral schemes. I am asked to show that there is a dense open subset $U \subseteq Y$ such that the induced morphism $f^{-1}(U) \longrightarrow U$ is finite. 
I am given a hint that I should first show that the function field of $X$ is a finite extension of the function field of $Y$. I am having trouble showing this part to begin with. Here is my attempt so far:
Let $\epsilon$ and $\eta$ be the generic points of $X$ and $Y$ respectively. These are unique since $X$ and $Y$ are integral. Also by integrality, we have that ever open set in $Y$ is dense, and so any affine $\text{Spec } B \subseteq Y$ contains the generic point $\eta$. Since $f$ is finite-type, we have
$$
f^{-1}({\text{Spec } B}) = \bigcup_{i} \text{Spec } A_{i}
$$
where each $A_{i}$ is a finitely generated $B$-algebra. Again, each of these $A_{i}$ are integral domains and must all contain the generic point of $X$, $\epsilon$. Choosing one of these $A_{i}$, which we will just call $A$, we have an exact sequence (since it is a finitely generated $B$-algebra):
$$
B[t_{1}, t_{2}, \ldots , t_{m}] \rightarrow A \rightarrow 0.
$$
Denote the residue field of the generic point $\eta \in Y$ by $\kappa_{\eta}$. By right exactness of the tensor product, we have
$$
\kappa_{\eta}[t_{1}, t_{2}, \ldots , t_{m}] \rightarrow A \otimes_{B}\kappa_{\eta} \rightarrow 0.
$$
That is, we have that $A \otimes_{B} \kappa_{\eta}$ is a finitely-generated $\kappa_{\eta}$-algebra. By Noether's Normalization, we then have a finite collection $\{ y_{1}, y_{2}, \ldots , y_{d} \}$ of algebraically independent elements of $A \otimes_{B}\kappa_{\eta} $ such that 
$$
\kappa_{\eta}[y_{1}, y_{2}, \ldots , y_{d}] \rightarrow A \otimes_{B} \kappa_{\eta}
$$
makes $A \otimes_{B} \kappa_{\eta}$ into a finitely generated module over $\kappa_{\eta}[y_{1}, y_{2}, \ldots , y_{d}]$. Then we can consider the induced morphism of affine schemes
$$
\phi: \text{Spec} \left( A \otimes_{B} \kappa_{\eta}  \right) \rightarrow   \text{Spec}\left( \kappa_{\eta}[y_{1}, y_{2}, \ldots , y_{d}] \right).
$$
Since the morphism $f$ is generically finite, we have that $\text{Spec} \left( A \otimes_{B} \kappa_{\eta}  \right)$ has only finitely many points. So if I could somehow show that the above map is surjective, I would be done (since the only way $\kappa_{\eta}[y_{1}, y_{2}, \ldots , y_{d}]$ could have only finitely many primes is if $d=0$ ). However, the best I have is that it is surjective onto a closed subset of 
$$
\text{Spec}\left( \kappa_{\eta}[y_{1}, y_{2}, \ldots , y_{d}] \right),
$$
which (as far as I can tell) might be finite. That is, $\ker \phi$ might contain all but finitely many primes, and hence I would not be able to deduce that $d=0$. I would like to make some kind of Going-Up argument, but I required that quotienting by $\ker \phi$ doesn't kill all but finitely many primes.
Is anyone able to point me in the right direction on this? Is my approach up to this point ok? How am I able to conclude the argument from here? 
 A: Let $\renewcommand{\Spec}{\operatorname{Spec}}\renewcommand{\Frac}{\operatorname{Frac}}\renewcommand{\ol}{\overline}\Spec A$ be an open affine subscheme of $Y$ and suppose $\Spec B$ is an open affine subscheme of $X$ contained in $f^{-1}(\Spec A)$.
As $f(\Spec B)\subset \Spec A/\ker(A\to B)$, we see that if $V(\ker(A\to B))$ is a proper subset of $\Spec A$, $f$ can't be dominant.
But this implies that $D(\ker(A\to B))=\emptyset$, so $\ker(A\to B)$ is a nilpotent ideal and since $A$ is a domain, $\ker(A\to B)=0$ and $A\to B$ is an injection.
This gives an injection on function fields $\Frac A\to\Frac B$.
Writing $B=A[x_1,\cdots,x_n]$ where the $x_i\in B$ by the finite-type hypothesis, we see that the fiber over the generic point is exactly the spectrum of $\Frac(A)\otimes_A A[x_1,\cdots,x_n] = \Frac(A)[x_1,\cdots,x_n]$.
This is an integral domain with fraction field $\Frac(B)$.
If the transcendence degree of $\Frac(A)\subset\Frac(B)$ is positive, then one of the $a_i$ is transcendental and we can find infinitely many prime ideals in $\Frac(A)[x_1,\cdots,x_n]$ by considering ideals of the form $(m_{\alpha}(x_i))$ as $m_\alpha$ runs over the irreducible polynomials in one variable over $\Frac(A)$ (there are infinitely many of these: any irreducible polynomial gives finitely many roots of $\ol{\Frac(A)}$, the algebraic closure of $\Frac(A)$, and any algebraically closed field is infinite).
So $\Frac(X)=\Frac(A)\subset\Frac(B)=\Frac(Y)$ is algebraic and finitely generated as a field extension, so it is a finite extension.
Next I claim that we can find an $a\in A$ so that for any $\Spec B\subset f^{-1}(\Spec A)$, the map $\Spec B_a\to \Spec A_a$ is finite.
Write $B=A[x_1,\cdots,x_n]$ as in the previous paragraph.
For any $x_i$, we can obtain a polynomial with coefficients in $A$ satisfied by $x_i$ by writing the minimal polynomial for $x_i$ over $\Frac(A)$ and clearing denominators.
Let $l_i$ be the leading coefficient of each such polynomial.
Letting $a=\prod l_i$, we see that $A_a\to B_a$ makes $B_a$ finitely generated as a module over $A_a$ and the claim is proven.
By picking a finite cover of $f^{-1}(\Spec A)$ and repeating this process finitely many times, we may assume that our original $\Spec A$ was selected so that it was covered by finitely many open affines $\Spec B\subset X$ each of which are finite over $\Spec A$.
Now I claim that if we have a morphism $X\to \Spec A$ where $X$ and $\Spec A$ are integral and $X$ is covered by finitely many open affines $\Spec B_i$ so that $\Spec B_i\to \Spec A$ is finite for all $i$, then we can find an element $a\in A$ so that $X_a\to \Spec A$ is an affine morphism.
Let $W=\bigcap \Spec B_i$, where the $\Spec B_i$ are the finitely many open affines covering $f^{-1}(\Spec A)$.
Since $X$ is irreducible and the intersection is finite, $W$ is nonempty and open.
By repeated applications of the fact that any intersection of open affines can be covered by simultaneously-distinguished affine opens, we can find an affine open subset $V\subset W$ which is distinguished in every $\Spec B_i$ (that is, $V=\Spec (B_i)_{b_i}$ for all $i$).
Since $A\to B_i$ is finite for all $i$, each $b_i$ satisfies a monic polynomial with coefficients in $A$.
Let $c_i$ be the (nonzero) constant terms of these polynomials, and let $a=\prod c_i$.
Then $(B_i)_a\cong (B_j)_a$ for all $i,j$ in a manner compatible with the maps from $A_a$, and so $\Spec (B_i)_a$ is exactly the preimage of $\Spec A_a$ under $f$.
Thus $\Spec A_a$ is a dense affine open subset of $Y$ so that $f^{-1}(\Spec A_a)\to\Spec A_a$ is finite and we're done.
